Home   ::  Login   ::  Register   ::  Post

:: Computers & Technology

schedule computer shutdown or reboot using windows powershell

SpiderTip
SpiderTip
Posted: 2015-07-10

You can shutdown or reboot a remote computer using Powers-shell. To shutdown the computer, use Stope-Computer cmdlet or use Restart cmdlet to restart the computer. The command to shutdown a computer in Power-shell is: Stop-Computer - Shuts down the current computer Stop-Computer -computername PC1 - Shuts down a remote computer named "Pc1" The command to restart a computer in Power-shell is: Restart-Computer - Restart the current computer Restart-Computer -computername PC1 - Restarts a remote computer named "Pc1" Command to shutdown multiple computers: - You can store multiple computers in a variable and shutdown them down all at once. $comps ="pc1, pc2, server1, server2" Stop-Computer -computername $comps -force You can also schedule a power shell script to shutdown computers using Windows Task Scheduler. To do this: 1. Put the computer names in text file. We will call the text file reboots.txt in this example and save it under c: drive. 2. Create another text file and save it as reboots.ps1. 3. Put this command in the reboots.ps1 file Stop-Computer -ComputerName (get-content c:
eboot.txt) -Force
4. Schedule reboots.ps1 file to run using Windows Task Scheduler.

© Copyright 2019-2020 SpiderTip.Com