Monday 9 January 2012

A Quick Way to Find Server Up-Time in Server Core or Hyper-V Server

Open an elevated command prompt and:

  1. systeminfo | find “System Boot Time:”

Our report:

C:\>systeminfo | find "System Boot Time:"
System Boot Time:          1/3/2012, 11:22:30 AM

Hat tip: Petri: Seven Simple Ways to Find Your Uptime in Windows Server 2008

Note that this command can be run on almost any Windows OS.

UPDATE: Thanks to vNiklas we have the following PowerShell command run via an elevated PowerShell session:

  1. (get-date)-([System.Management.ManagementDateTimeconverter]::ToDateTime((Get-WmiObject win32_operatingsystem).lastbootuptime)) [Enter]

Our output:

PS C:\>  (get-date)-([System.Management.ManagementDateTimeconverter]::ToDateTime((Get-WmiObject win32_operatingsystem).lastbootuptime))

Days              : 6
Hours             : 4
Minutes           : 44
Seconds           : 31
Milliseconds      : 872
Ticks             : 5354718724344
TotalDays         : 6.19759111613889
TotalHours        : 148.742186787333
TotalMinutes      : 8924.53120724
TotalSeconds      : 535471.8724344
TotalMilliseconds : 535471872.4344

Philip Elder
Microsoft Small Business Specialists
Co-Author: SBS 2008 Blueprint Book

*Our original iMac was stolen (previous blog post). We now have a new MacBook Pro courtesy of Vlad Mazek, owner of OWN.


vniklas said...

if you are using powershell instead you can use following oneliner (get-date)-([System.Management.ManagementDateTimeconverter]::ToDateTime((Get-WmiObject win32_operatingsystem).lastbootuptime))

And there you will not have to do the math and count days :-)

stryqx said...

Still using NT4's uptime.exe utility! :-)

Doug H. said...

I prefer uptime.exe as well. It's fast and easy to remember. I just drop it into System32 on PCs.

\\XXXX has been up for: 0 day(s), 11 hour(s), 32 minute(s), 18 second(s)

Anonymous said...

I'm doing my head in trying to extract just the minutes out of that?

Philip Elder Cluster MVP said...

To date we have used this command line to have a good idea of where we are at time wise.

For the most part we reboot all nodes in a cluster on the same day so we are looking for anomalies in time that indicate a node problem.

Thanks folks!