Home All Groups Group Topic Archive Search About


Author
12 Mar 2007 2:06 PM
George
Hello,

Please help me to find the 'last system restart time' for a group of servers
in Windows 2003 AD using VB script. At present we are using 'net statistics '
command to find the last restart time in each servers.

Thanks.

Author
14 Mar 2007 5:24 PM
urkec
You can use WMI Win32_OperatingSystem class:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")

Set colOS = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem")

For Each objOS in colOS
WScript.Echo objOS.LastBootUpTime
Next

This gets the last bootup time for the local computer. I hope it gets you
started.

--
urkec


Show quote
"George" wrote:

> Hello,
>
> Please help me to find the 'last system restart time' for a group of servers
> in Windows 2003 AD using VB script. At present we are using 'net statistics '
> command to find the last restart time in each servers.
>
> Thanks.

AddThis Social Bookmark Button