Q & A: Finding Your Last Server Boot Time with PowerShell

See how to retrieve the last boot time of your server with PowerShell.

Michael Otey

December 14, 2015

1 Min Read
Q & A: Finding Your Last Server Boot Time with PowerShell

For more technical explainers on PowerShell, read our updated 2021 report: PowerShell 101: A Technical Explainer for IT Pros.

Q: How can I use PowerShell to get the last boot time for a server using PowerShell?

A: If you have PowerShell 3.0 you can use WMI and the Get-CimInstance cmdlet to return the date and time of the last time the server was booted up. To retrieve the last bootup date and time you can select the LastBootUptime property from the Win32_Operatingsystem WMI class like you can see in the following listing.

PS C:UsersAdministrator> Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime


The csname property returns the computer name and the lastbootuptime property returns the date and time of the last system boot. You can see an example of the output of the Get-CimInstance below.

csname    lastbootuptime

------    --------------

WS2016-N0 12/14/2015 7:40:06 AM

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like