PowerTip: Use PowerShell to Shut Down a Remote Computer

PowerTip: Use PowerShell to Shut Down a Remote Computer

  • Comments 5
  • Likes

Summary: Use Windows PowerShell to shut down a remote computer.

Hey, Scripting Guy! Question I need to shut down a remote computer, but the account that I am logged on to does not have rights. What should I do?

Hey, Scripting Guy! Answer Use the Stop-Computer cmdlet and specify both the name of the remote computer and the credentials to use for the operation. When the cmdlet runs, you will be prompted for a password, as shown here.

Stop-Computer –computer DC1 –Credential nwtraders\administrator


Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • nice post.. wonderful powerful shutdown

  • I got this error when trying to connect to a remote server. Is there a way to kick the user off if they are not available to log off?

    Stop-Computer : This command cannot be executed on target computer(MyServer) due
    to following error: The system shutdown cannot be initiated because there are other user
    s logged on to the computer.
    At line:1 char:14
    + stop-computer <<<< -computer MyServer -Credential \balderos_admin
    + CategoryInfo : InvalidOperation: (MyServer:String) [Stop-Computer],
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.S

  • Phil wants to "kick" users. This may not be a good idea. It requires travel all the way to the users desk then a big kick. You may break you foot in the process. Thus is the result of the use of "force".

    Try using force on the command instead of the user. In fact - try using help before using force or wining about users who are no cooperating.

    HELP Stop-Computer -Full

    Read everything. Reading is good for you. Practice reading regularly. It help you to avoid misplaced force.


  • Stop-Computer –computer DC1 -Force –Credential nwtraders\administrator

  • How to fix: "enable the remote shutdown access rights and restart the computer". I am an administrator on the server, it has Remote Registry enabled, Set-Execution Policy Unrestricted, and Enable-PSRemoting. Now what?