Boot and Install Time for Operating System

by Jul 1, 2020

The WMI class Win32_OperatingSystem provides rich information about a number of datetime information, including the date of last boot-up and the installation time:

$dateTimeProps = 'InstallDate', 'LastBootupTime', 'LocalDateTime', 'CurrentTimeZone', 'CountryCode'

Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property $dateTimeProps

The result looks similar to this:

InstallDate     : 03.09.2019 12:42:41
LastBootupTime  : 03.05.2020 12:15:45
LocalDateTime   : 04.05.2020 10:43:55
CurrentTimeZone : 120
CountryCode     : 49   

If you’d like to know how many minutes your system is running, or how many days have been passed since it was installed, use New-TimeSpan:

$os = Get-CimInstance -ClassName Win32_OperatingSystem

$installedDays = (New-TimeSpan -Start $os.InstallDate).Days
$runningMinutes = [int](New-TimeSpan -Start $os.LastBootupTime).TotalMinutes

"Your copy of Windows was installed $installedDays days ago."
"Your system is up for {0:n0} minutes." -f $runningMinutes

The result looks like this:

Your copy of Windows was installed 243 days ago.
Your system is up for 1.353 minutes.   

The Get-CimInstance cmdlet can be used to query the information locally and for remote machines (provided you have proper permissions). For more information on how to use Get-CimInstance remotely, visit


Twitter This Tip! ReTweet this Tip!