Code.Report

Insights for productivity and tech related info

Power off computer with Powershell

2019-09-28 Code.Reportwindows

How to power off a computer (or a list of) with one powershell command

Let’s say you need to execute a long script but needs to power off the computer after the execution. You can end the script with:

Stop-Computer

If you want to try the command but without it actually executing, try with the -WhatIf parameter! It will show what would be executed without actually doing it!

Stop-Computer -WhatIf

The command let’s you power off multiple systems as well, just name them on the command. If you are going to try this at your works network, please use it with the -WhatIf parameter!

Stop-computer -ComputerName ‘computer01′,’computer02′,’computer03’