How to find computer's uptime/boot time by command & script?
- Last Updated: Wednesday, 09 March 2016 04:13
- Hits: 4652
Method 4 - From Event Viewer.
Step 1 - Open Event viewer from computer management or open Run and type “eventvwr”
Step 2 - Expand Windows logs and select system.
Step 3 - Click on Filter Current Log.. from right action panel. And type 6005 in field - <All Event IDs>
Step 4 - See latest log date and time, This date and time is the system boot time/uptime since.
Method 5 -You can also get this from WMI scripting. See below microsoft link for details.
Method 6 -From Powershell scripting, ANd here you can get uptime information, When you need for many server, And uptime will generate in a txt file.
Step 1 - Download uptime.ps1 by click here, Or use below script code and create a .ps1 file and put this in a folder. Here for example making a folder name - UptimeReport in C: drive
Script code -
$serverlist = "C:\uptimereport\serverlist.txt"
$reporttextfile = "C:\uptimereport\uptime.txt"
out-file -filepath $reporttextfile -append -InputObject ("Uptime Report Run " + (Get-Date))
foreach ($server in Get-Content s1.txt)
$ping = gwmi win32_pingstatus -f "Address = '$server'"
if($ping.statuscode -eq 0)
$wmi = Get-WmiObject -ComputerName $server -Query "SELECT LastBootUpTime FROM Win32_OperatingSystem"
$now = Get-Date
$boottime = $wmi.ConvertToDateTime($wmi.LastBootUpTime)
out-file -filepath $reporttextfile -append -InputObject ("Uptime for " + $server + ": " + ($now - $boottime))
out-file -filepath $reporttextfile -append -InputObject ("Uptime for " + $server + ": Host offline")
Step 2 - Edit some lines from above script.
Change “C:\uptimereport\serverlist.txt” path to your server list file path, in which .txt file you can put multiple server list in below format.
Change “C:\uptimereport\uptime.txt” path to your result file path, Where you can get uptime report of all your server.
Step 3 - Open PowerShell and run the .ps1 file then you will get your all server uptime report in above path of step 2 line 2.
Keyword - How to find Windows uptime?, How to Find Your Computer's Uptime and Installation Date, How to get the uptime in windows, How to Find the Uptime or Boot Time of a Server, How to find the system uptime in a Windows Server, Command line - How to find out uptime on Windows, Find server uptime in bulk by powershell, Powershell script to known multiple server uptime, Find system uptime on Server 2012, How To Check Your System's Uptime In Windows 7 | Vista | XP, Find Your Uptime in Windows Server 2008 / R2, Finding the Uptime of Windows Server 2008, Windows 10: How to See System Uptime
- << Prev