Get-Uptime

Get the TimeSpan since last boot.

Syntax

Get-Uptime []
Get-Uptime
   [-Since]
   [<CommonParameters>]

Description

This cmdlet returns the time elapsed since the last boot of the operating system.

Examples

Example 1 - Show time since last boot

Get-Uptime

Days              : 9
Hours             : 0
Minutes           : 9
Seconds           : 45
Milliseconds      : 0
Ticks             : 7781850000000
TotalDays         : 9.00677083333333
TotalHours        : 216.1625
TotalMinutes      : 12969.75
TotalSeconds      : 778185
TotalMilliseconds : 778185000

Example 2 - Show the time of the last boot

Get-Uptime -Since

Tuesday, June 18, 2019 2:34:56 PM

Parameters

-Since

Cause the cmdlet to return a DateTime object representing the last time that the operating system was booted.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.TimeSpan

This is the default return type when no parameters are used.

System.DateTime

This is the type return when using the Since parameter.

Notes

On Windows, the value returned will be the same as the LastBootUpTime property of the Win32_OperatingSystem class in WMI.