cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rbutler
Engaged Sweeper

I had an issue where I needed to remotely restart a computer but wasn't currently logged into a Domain Administrator account. I found a quick and simple powershell command and then adapted it into a Custom Action.

I placed it at the bottom of the list of built-in commands with "(PS)" added to the description. I also "turned on the safety" by checking that confirmation checkbox.

Expected behavior is that it will ask for confirmation, then pop up a powershell window, then pop up asking for the password for your given admin user account.

Reboot (PS):

powershell -noprofile -ExecutionPolicy bypass -command "&{ Restart-Computer -ComputerName {smartname} -Credential DOMAIN\ADMINUSERNAME -Force }



Shutdown (PS):

powershell -noprofile -ExecutionPolicy bypass -command "&{ Stop-Computer -ComputerName {smartname} -Credential DOMAIN\ADMINUSERNAME -Force }



Replace "DOMAIN\ADMINUSERNAME" with a Domain Admin account and you should be golden. Alternatively, replace it with "(Get-Credential)" to prompt for both the username and password each time.

I'm not digging into how to provide both the username AND password in this as I don't like passwords stored in plaintext and don't feel like figuring out how to store it into a secure string for this little command.

0 REPLIES 0