Script for remote reboot/shutdown, power off and more.
Script for remote reboot/shutdown, power off, etc. You must have proper rights on a remote computer for this script to work.
' Script for remote reboot/shutdown, power off, etc.
' You must have proper rights on a remote computer
' for this script to work
Dim StationName
Dim OpSysSet
Dim Flags
Dim Reserved
StationName = InputBox("Insert the Name of the Station to be Shutdown.")
Set OpSysSet = GetObject("winmgmts:{impersonationLevel=impersonate,(RemoteShutdown)}//" & StationName).ExecQuery("select * from Win32_OperatingSystem where Primary=true")
' Flags Action
'Â 0Â Â Â Logoff
'Â 1Â Â Â Shutdown
'Â 2Â Â Â Reboot
'Â 4Â Â Â Force
'Â 8Â Â Â Power Off
' 16Â Â Â Force If Hung
Flags = 8
Reserved = 0
For Each OpSys In OpSysSet
  OpSys.Win32Shutdown Flags,Reserved
Next

