Not sure where I got this from but it works most of the time
library.vbs - set this to run on a scheduled task, we have different areas to switch off at different times - this is the library one.
user / password is domain admin usually - thats what I use
Code:
On Error Resume Next
Dim oFSO, oTS, sClient, oWindows, oLocator, oConnection, oSys
Dim sUser, sPassword
'set remote credentials
sUser = ""
sPassword = ""
'open list of client names
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTS = oFSO.OpenTextFile("C:\Shutdown\library.txt")
Do Until oTS.AtEndOfStream
'get next client name
sClient = oTS.ReadLine
'get WMI locator
Set oLocator = CreateObject("WbemScripting.SWbemLocator")
'Connect to remote WMI
Set oConnection = oLocator.ConnectServer(sClient, _
"root\cimv2", sUser, sPassword)
'issue shutdown to OS
' 4 = force logoff
' 5 = force shutdown
' 6 = force rebooot
' 12 = force power off
Set oWindows = oConnection.ExecQuery("Select " & _
"Name From Win32_OperatingSystem")
For Each oSys In oWindows
oSys.Win32ShutDown(5)
Next
Loop
'close the text file
oTS.Close
'WScript.Echo "All done!"
Then you list the machines in a text file (in this case c:\shutdown\library.txt)
This way you can easily omit machines etc..
save this as library.txt
Code:
SNR-library-1
SNR-library-2
SNR-library-3
SNR-library-7
SNR-library-8
SNR-library-9