Reputation: 2133
What code do I need for a C# application to restart the user's IIS while the user does not have Admin rights?
Upvotes: 2
Views: 2130
Reputation: 5695
I don't think it's possible through code alone (and if it was, it'd be an exploit.)
You'd need to write a daemon that ran as a privileged user that accepted restart commands from unprivileged sources, say by checking for the existence of a lockfile or similar, or accepting commands over a socket, and then restarted the server accordingly.
Which would be a serious security risk, still, but whatever floats your boat.
It still might be better to think hard about why you want to do this. I think you'll find that whatever criteria prevent you from making the relevant user an IIS admin are excellent arguments for why the user shouldn't be rebooting IIS either.
Upvotes: 4