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

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

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

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:\Users\Administrator> 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

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish