It looks like it’s going to be a week of scripting blog posts. Today’s script is used to reboot a list of remote computers. Sometimes, when deploying security patches, the computers fails to reboot. So I use this script to force reboots. It would be a piece of cake to modify the script, so that it turns off the computers instead.
One of my customers should find that useful. Out of 2000 computers, about 150 computers get left powered on over the weekend.
What the script does:
- reads the list of computers to be reset from C:\computer_lists\reboot_target_list.txt
the format of the list is COMPUTERNAME,Reboot Reason
- “Pings” the computer to see if it’s on the network.
- checks to see if someone is logged on. If someone is, don’t reboot.
- reboots the computer.
Check and reboot computers.ps1