PowerShell – Get System up time

Checking system uptime is a quick way to know how long the system has been running without interruptions to service.

The quickest way to check the system up time on your own machine to check the same from Task Manager. You can launch task manager and go to performance tab to find system uptime.

You can use below PowerShell script to quickly check the uptime of a remote machine. The script will use WMI call to retrieve the information.

$Computer = Read-Host   "Input Computer Name "
$LastBoot = (Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer ).LastBootUpTime
$uptime = (Get-Date) - [System.Management.ManagementDateTimeconverter]::ToDateTime($LastBoot)
Write-Host  "$Computer uptime is:"     [$uptime]   [dd:hh:mm:ss.ms]

Related Posts:

Subscribe to Techuisitive Newsletter

Be the first to know about our new blog posts. Get our newsletters directly in your inbox and stay up to date about Modern Desktop Management technologies & news.

Scroll to Top