Archived

This topic is now archived and is closed to further replies.

the_grip

Rebooting a system via VB

Recommended Posts

Hey all, i''m working on a script in VBScript for our network that will reboot a system at the end of the script. However, i can''t find how to do this... anyone know (VB will work for the most part in VBScript, so if you know how to in VB, please post...). Thanks! "You call him Dr. Grip, doll!"

Share this post


Link to post
Share on other sites
This is what I''ve used at work to reboot remote W2K boxes via VB script. Of course, you must have admin privilages on the box.

Dim opsysset

Set opsysset = GetObject("winmgmts:{impersonationLevel=impersonate,(RemoteShutdown)}//machinename").ExecQuery("select * from Win32_OperatingSystem where Primary=true")

For Each OpSys In opsysset
OpSys.reboot
Next

This was taken from the WMI examples in MSDN. WMI is very handy, you can do about 90% of what you can do with a mouse/keyboad through WMI programatically. The trick is to find documentation...

Share this post


Link to post
Share on other sites