Tutorial :Is it possible to Shut down a local pc with group policies programatically through .net application?



Question:

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


Solution:1

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »