PowerTip: Use PowerShell to Shut Down a Remote Computer

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


Comments (10)

  1. vbltechnologies says:

    nice post.. wonderful powerful shutdown

  2. 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


  3. nu-bee says:

    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.


  4. Rehan Ahmed says:

    Stop-Computer –computer DC1 -Force –Credential nwtradersadministrator

  5. Crisp says:

    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?

  6. micheal rosen says:

    more noice post m8

  7. MrZaka says:

    Usefull reading…

  8. Just in case it can help someone…

    Stop-Computer –computer srvname -Force
    (in powershell running as admin)


  9. GS says:

    How can shutdown reason codes be included when shutting down with Powershell?

  10. Awesome post. Now we can Remotely shutdown computer with my android phone in just one click. This is really looks like a professional.
    Thank you