Let us see the PowerShell stop command for shutting down our computers. We have to use the simple Stop-Computer command to shutdown the computer. If you are looking to shut down the remote computer, you can just use the same command.
- Shut down using stop-computer.
- Shut down multiple computers using stop-computer.
- Restart the computer using PowerShell.
Shut down the computer using Stop-Computer command:
- Press the start button.
- Type PowerShell and choose the application shown in the image.
- Enter the following command.
- PowerShell is case insensitive so the above command must work without a problem.
- The previous command will shut down the computer in which the PowerShell terminal is running.
- We can shut down the remote computer by using the remote computer name as shown in the command below.
- Here replace the <RemoteComputerName> with the name of your remote computer.
- Note that the command will shut down the remote computer named TecKangarooWindowsServer.
Stop Multiple Remote Computers/Server using PowerShell
We can stop multiple computers using the same PowerShell command. For this, we will use a PowerShell variable to save the names of all the remote computers and shut them down using the same variable name. Follow the below steps for shutting down multiple computers.
- Create a variable with multiple servers as shown in the image.
- We are creating a variable and saving the necessary server names in it.
- Please note that you need to provide your server names in order for it to work for you.
- Use the stop-computer command for shutting down the computers.
Restart Computer using PowerShell:
In this bonus section, we will see how to restart the computer instead of shutting down. The command is easy because we have to only replace the shut down with restart.
Replace the <RemoteComputerName> with the name of the computer that you want to restart.
It is easy to shut down a computer using the PowerShell command. The user have to use only the shut-down command along with the -computername switch for specifying the computer name. In the case of multiple computers, suitably multiple remote computers, we can use the PowerShell variable to store up all the names in one variable and pass the variable to the command.
We can replace the shut-down command with restart-computer to restart the computer.
For more such awesome posts, stay tuned to TecKangaroo.