LLI Wiki — My Digital Knowledge Base

Get the Windows last boot time with PowerShell

Show the last Windows boot time with WMI or CIM, and search the System event log with PowerShell.

To get the date and time of the last Windows boot, you can query the win32_operatingsystem class with WMI or with CIM.

With WMI

Get-WmiObject win32_operatingsystem | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConvertToDateTime($_.lastbootuptime)}}

With CIM

Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime

Search the System event log

The following command lists System log entries whose message contains "failed":

Get-EventLog -LogName System -Message "*failed*" | Format-List
Mastodon LLIMastodon SocialFosstodon