Remote Computers Reboot Script

Oct 4, 2015 | | Say something

Clean and effective script to reboot a list of computers remotely. Change the text highlighted in red to best fit your needs.

–Script Start–

Set WSHShell = WScript.CreateObject(“WScript.Shell”)
Set oFS = CreateObject(“Scripting.FileSystemObject”)

strWarning = “Due to system maintenance, this computer must be restarted. You have 10¬†minutes to save your work from the start of this countdown. Sorry for any inconvenience caused.
strDelay = 600¬†‘Delay given in seconds; change this value to your preference, or set it to 0 to give no delay at all

‘Open a text file of computer names
‘with one computer name per line
Set oTS = oFS.OpenTextFile(“C:\Temp\computers.txt“)

‘go through the text file
Do Until oTS.AtEndOfStream
‘get the next computer name
‘store it in variable strCompname
strCompname = oTS.ReadLine
WshShell.Run “C:\Windows\System32\shutdown.exe -m \\” & strCompname & ” -r -c ” & Chr(34) & strWarning & Chr(34) & ” -t ” & strDelay¬†‘Replace the “-r” switch with “-s” to make the computers shutdown instead
‘close the text file

–Script End–

1,846 total views, 3 views today

Posted in: Scripts | Tags: , ,

Leave a Reply