Problem rebooting 
Author Message
 Problem rebooting

OK, I have a script execute to reboot the machine. I receive and error:
     SWBemObject: Privilege not held.

Here is the script:
     Set SystemSet = GetObject("winmgmts://").ExecQuery("select * from
Win32_OperatingSystem where Primary=true")
     wScript.Echo "Rebooting..."

     For Each System In SystemSet
          System.Reboot
     Next

     wScript.Quit

Any advice??

TIA
Luey



Tue, 24 Jun 2003 05:32:55 GMT  
 Problem rebooting
'Win32_OperatingSystem
'http://msdn.microsoft.com/library/psdk/wmisdk/clasops_0h7x.htm

Set wmi = GetObject("winmgmts:{(Shutdown)}")
set objset = wmi.instancesof("win32_operatingsystem")
for each obj in objset
  set os = obj :  exit for
next

'os.shutdown
'os.reboot

Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8
'
'os.win32shutdown EWX_blablah

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> OK, I have a script execute to reboot the machine. I receive and error:
>      SWBemObject: Privilege not held.

> Here is the script:
>      Set SystemSet = GetObject("winmgmts://").ExecQuery("select * from
> Win32_OperatingSystem where Primary=true")
>      wScript.Echo "Rebooting..."

>      For Each System In SystemSet
>           System.Reboot
>      Next

>      wScript.Quit

> Any advice??

> TIA
> Luey




Tue, 24 Jun 2003 13:49:18 GMT  
 Problem rebooting
Wonderful!

Thanks again Michael!


Quote:
> 'Win32_OperatingSystem
> 'http://msdn.microsoft.com/library/psdk/wmisdk/clasops_0h7x.htm

> Set wmi = GetObject("winmgmts:{(Shutdown)}")
> set objset = wmi.instancesof("win32_operatingsystem")
> for each obj in objset
>   set os = obj :  exit for
> next

> 'os.shutdown
> 'os.reboot

> Const EWX_LOGOFF = 0
> Const EWX_SHUTDOWN = 1
> Const EWX_REBOOT = 2
> Const EWX_FORCE = 4
> Const EWX_POWEROFF = 8
> '
> 'os.win32shutdown EWX_blablah

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --



> > OK, I have a script execute to reboot the machine. I receive and error:
> >      SWBemObject: Privilege not held.

> > Here is the script:
> >      Set SystemSet = GetObject("winmgmts://").ExecQuery("select * from
> > Win32_OperatingSystem where Primary=true")
> >      wScript.Echo "Rebooting..."

> >      For Each System In SystemSet
> >           System.Reboot
> >      Next

> >      wScript.Quit

> > Any advice??

> > TIA
> > Luey




Wed, 25 Jun 2003 01:25:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Weird Rebooting Problem

2. WMI Privilege Problem on Reboot call

3. PDW and reboot problem

4. System reboot problem

5. Reboot : How to prevent user to reboot the computer?

6. Reboot

7. Reboot script

8. Take control of the system after a reboot

9. using WMI to reboot

10. Preventing reboot? message

11. Reboot into Safe Mode

12. rebooting a PC from a link on Active Desktop

 

 
Powered by phpBB® Forum Software