Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
1 like 0 dislike
921 views
in PowerShell by 12 13 20
I have a PowerShell script that requiers to shutdown or Power off my computer once the script finish, How I turn off my comupter using Windows PowerShell?

1 Answer

2 like 0 dislike
by 159 200 385
selected by
 
Best answer

How to Stop the local computer using PowerShell?

You can use Stop-Computer cmdlet to shut down the local computer as the following:

Example 1:

Stop-Computer

Example 2:

Stop-Computer -ComputerName localhost

How to Stop the remote computer using PowerShell?

You can use Stop-Computer cmdlet to shut down remote computers as the following:

Example 1:

Stop-Computer -ComputerName "Server01", "Server02"

How to Stop the local and remote computer using PowerShell?

You can use Stop-Computer cmdlet to shut down the local and remote computers as the following:

Example 1:

Stop-Computer -ComputerName "Server01", "Server02",localhost

See More examples at Stop-Computer

If you don’t ask, the answer is always NO!
...