views:

147

answers:

1

I have a local application running with an user than have a group policy indicating this user can’t shutdown the pc.

And then I use your code, but when I ask by user and password to impersonate my app. I received the next error

System.Management.ManagementException: it’s not possible to use the user’s credentials for the local connections

Regards

A: 

I would try using the Process.Start() overload that allows one to supply a username and password. I would execute shutdown.exe on that new process.

Of course, storing the username and password is not terribly secure and could probably be hacked by anyone that wanted to spend enough time with it.

Lee