Quantcast
Viewing latest article 3
Browse Latest Browse All 4

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

Viewing latest article 3
Browse Latest Browse All 4

Trending Articles