Restart or Shutdown a Remote Computer with PowerShell

In this article I’ll show you a few examples of how you can restart or shutdown computers with PowerShell. PowerShell doesn’t have as many options as the default shutdown command. For example, there is no option to prompt users with a custom message or provide a countdown.

Because there is no default PowerShell option to prompt users with a custom message, I write a two simple PowerShell scripts that will prompt the user with a custom message. In a future article I will show you a PowerShell restart or shutdown function with a custom message option.

Example 1

This PowerShell command will immediately restart a local or remote computer. The -Force option will force a restart even if a user or users are logged on.

Example 2

This command will shutdown a local or remote computer. Use the -Force to force a shutdown even if a user or users are logged on.

Example 3

This can be useful if you have several computers to restart. Just list all the computers you want in a text file and add that to the PowerShell command.

Example 4

This can be useful if you have several computers to shutdown. Just list all the computers you want in a text file and add that to the PowerShell command.

Example 5

Because there is no default PowerShell option to prompt users with a custom message, you could probably go with something like this:

or

This will send a popup message to any logged in user on the affected computer.

Be careful when you restart or shutdown a remote computer when users are still logged on 😉

I really like to hear what you have to say about this article:

  • Was this article helpful for you or do you have any questions?
  • Do you have additions, suggestions or any other ideas?
  • Just let me know by leaving a comment below.

Thank you for spending some time at my site and in my blog. I hope you come to visit again soon!

About Lex van der Horst 201 Articles
Techwire

Be the first to comment

Leave a Reply