Windows 2000 Pro - Shutdown/Restart PC 
Author Message
 Windows 2000 Pro - Shutdown/Restart PC

'===
' ref: Win32_OperatingSystem
' url: http://www.*-*-*.com/
'===

vMachineName = "machinename"

Set SystemSet = _
  GetObject("winmgmts://" & vMachineName & "/root/cimv2")_
    .ExecQuery("select * " _
    & "from Win32_OperatingSystem where Primary=true")

for each System in SystemSet
  with system
    msgbox .caption & " - version " & .version
    .Shutdown
  end with
next

--
Michael Harris
Microsoft.MVP.Scripting
--


Quote:
> Hi All,

> I urgently need the code to restart a W2K Pro Box.

> Also if anyone knows how to shutdown the same PC it would be greatly
> appreciated.

> Many Thanks,
> Steve



Fri, 14 Mar 2003 03:00:00 GMT  
 Windows 2000 Pro - Shutdown/Restart PC
This will assume the local machine's namespace:

Set SystemSet = _
  GetObject("winmgmts://")_
    .ExecQuery("select * " _
    & "from Win32_OperatingSystem where Primary=true")

for each System in SystemSet
  system.Reboot
next

--
Michael Harris
Microsoft.MVP.Scripting
--


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

> vMachineName = "machinename"

> Set SystemSet = _
>   GetObject("winmgmts://" & vMachineName & "/root/cimv2")_
>     .ExecQuery("select * " _
>     & "from Win32_OperatingSystem where Primary=true")

> for each System in SystemSet
>   with system
>     msgbox .caption & " - version " & .version
>     .Shutdown
>   end with
> next

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



> > Hi All,

> > I urgently need the code to restart a W2K Pro Box.

> > Also if anyone knows how to shutdown the same PC it would be greatly
> > appreciated.

> > Many Thanks,
> > Steve



Fri, 14 Mar 2003 03:00:00 GMT  
 Windows 2000 Pro - Shutdown/Restart PC

Hi All,

I urgently need the code to restart a W2K Pro Box.

Also if anyone knows how to shutdown the same PC it would be greatly
appreciated.

Many Thanks,
Steve



Sat, 15 Mar 2003 08:02:09 GMT  
 Windows 2000 Pro - Shutdown/Restart PC

Sorry but I am confused by your reply as my knowledge in these areas is
sadly lacking.

To clarify my somewhat vague request ,I am running a vbs script called after
the unattend
install of Windows 2000 Pro has completed.
The script customises the look and feel of the desktop aswell as installing
various applications.

During the course of the script I need to close windows and restart the
machine.

I need to know how to restart the PC running the script, which most likely
will not be network connected at this point

Knowing how to shutdown the same PC it would be a bonus

Thanking you for your patience with a slowbie,

Steve



Sat, 15 Mar 2003 08:41:07 GMT  
 Windows 2000 Pro - Shutdown/Restart PC

Mr Harris,
cool cool, just to add then,  i could use this in an argument of a logon
script, say,  vbno  - i could tell the pc to restart,  shut down etc ?

craniel


Quote:
> This will assume the local machine's namespace:

> Set SystemSet = _
>   GetObject("winmgmts://")_
>     .ExecQuery("select * " _
>     & "from Win32_OperatingSystem where Primary=true")

> for each System in SystemSet
>   system.Reboot
> next

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



> > '===
> > ' ref: Win32_OperatingSystem
> > ' url: http://msdn.microsoft.com/library/psdk/wmisdk/clasops_0h7x.htm
> > '===

> > vMachineName = "machinename"

> > Set SystemSet = _
> >   GetObject("winmgmts://" & vMachineName & "/root/cimv2")_
> >     .ExecQuery("select * " _
> >     & "from Win32_OperatingSystem where Primary=true")

> > for each System in SystemSet
> >   with system
> >     msgbox .caption & " - version " & .version
> >     .Shutdown
> >   end with
> > next

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



> > > Hi All,

> > > I urgently need the code to restart a W2K Pro Box.

> > > Also if anyone knows how to shutdown the same PC it would be greatly
> > > appreciated.

> > > Many Thanks,
> > > Steve



Sat, 22 Mar 2003 06:44:16 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Win 2000 Pro Restart - Again??

2. writing vbscript to know the OS of a remote PC ( is WIndows NT or WIndows 2000)

3. restart windows 2000 using vbscript

4. Automatically restarting a Windows 2000 service

5. Windows 2000 shutdown script ?

6. Windows 2000 Automated Shutdown

7. Installing VBScript on Windows 2000 Pro

8. Shutdown and restart windows

9. Shutdown and Restart Windows 95 and NT for VB Script

10. Can I vbscript a system shutdown/restart?

11. Restart/Shutdown Script

12. End Process in Win 2000 Pro

 

 
Powered by phpBB® Forum Software