Hiwj
2009-08-24 09:04:01 UTC
I am trying to run a script to reboot my servers with a scheduled task
(running as the Administrator):
Set OpSysSet =
GetObject("winmgmts:{(Shutdown)}!\\.\root\cimv2").ExecQuery("select * from
Win32_OperatingSystem where Primary=true")
For Each OpSys in OpSysSet
OpSys.Reboot()
Next
The script doesn't work. However, if I logon as the Administrator and run
the script then it works fine.
What's the difference from running it logged on as the Administrator,
compared to running it from a scheduled task as the Administrator?
(running as the Administrator):
Set OpSysSet =
GetObject("winmgmts:{(Shutdown)}!\\.\root\cimv2").ExecQuery("select * from
Win32_OperatingSystem where Primary=true")
For Each OpSys in OpSysSet
OpSys.Reboot()
Next
The script doesn't work. However, if I logon as the Administrator and run
the script then it works fine.
What's the difference from running it logged on as the Administrator,
compared to running it from a scheduled task as the Administrator?