Hi Guys

My last Web based post died upon submit so apologies if this appears twice.
I have a requirement to restart some workstations after removing some
registry entries and a service. My reboot code works under interactively
logged on user privileges but not under the security context of the startup
script (SYSTEM?).

The code executes fine without raising any errors but doesnt reboot. There
are no "On Error Resume Next" statements in the code and I have removed all
error handling. Any ideas?


Function ShutDown()

sComputerName = "."

Set oWMI = GetObject("winmgmts:" &
"{impersonationLevel=impersonate,(Shutdown, RemoteShutdown)}!\\" &
sComputerName & "\root\cimv2")
Set colOperatingSystems = oWMI.ExecQuery("Select * from
Win32_OperatingSystem")

' Attach to the first OS object

For Each obj in colOperatingSystems
obj.Win32Shutdown(6)
Next



End Function