Server uptime is one of the basic but important checks performed by infrastructure, system administration, and application support teams. Knowing when a server was last rebooted helps with troubleshooting, patch verification, maintenance validation, and operational monitoring.
This blog covers simple ways to check server uptime on Windows and Linux/UNIX, including how to check multiple servers at once and save the results to a report.
1. Check Windows Server Uptime Using PowerShell
PowerShell provides a reliable way to retrieve the server's last boot time using Win32_OperatingSystem.
Check Last Boot Time
(Get-CimInstance Win32_OperatingSystem).LastBootUpTime
Example:
Thursday, September 10, 2026 8:15:22 AM
Check Uptime
(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
Example:
Days : 7
Hours : 10
Minutes : 25
Seconds : 14
2. Display Windows Uptime in a Readable Format
For operational use, it is often easier to display the result as Days, Hours, and Minutes.
$os = Get-CimInstance Win32_OperatingSystem
$uptime = (Get-Date) - $os.LastBootUpTime
"Server : $env:COMPUTERNAME"
"Last Boot : $($os.LastBootUpTime)"
"Uptime : $($uptime.Days) Days, $($uptime.Hours) Hours, $($uptime.Minutes) Minutes"
Example output:
Server : JDESERVER01
Last Boot : 9/10/2026 8:15:22 AM
Uptime : 7 Days, 10 Hours, 25 Minutes
3. Check Multiple Windows Servers
If you have multiple Windows servers, there is no need to log in to each server individually.
Create a file called:
servers.txt
Add one server name per line:
WIN-SERVER01
WIN-SERVER02
WIN-SERVER03
WIN-SERVER04
WIN-SERVER05
Run the following PowerShell script:
$servers = Get-Content ".\servers.txt"
foreach ($server in $servers) {
try {
$os = Get-CimInstance Win32_OperatingSystem `
-ComputerName $server `
-ErrorAction Stop
$uptime = (Get-Date) - $os.LastBootUpTime
[PSCustomObject]@{
Server = $server
LastBoot = $os.LastBootUpTime
Uptime = "$($uptime.Days) Days, $($uptime.Hours) Hours, $($uptime.Minutes) Minutes"
}
}
catch {
[PSCustomObject]@{
Server = $server
LastBoot = "Unable to connect"
Uptime = "N/A"
}
}
}
Example result:
Server LastBoot Uptime
------ -------- ------
WIN-SERVER01 9/10/2026 8:15:22 AM 7 Days, 10 Hours, 25 Minutes
WIN-SERVER02 9/12/2026 2:32:10 PM 5 Days, 4 Hours, 8 Minutes
WIN-SERVER03 9/15/2026 6:21:45 AM 2 Days, 12 Hours, 35 Minutes
WIN-SERVER04 9/01/2026 9:05:31 AM 16 Days, 9 Hours, 18 Minutes
WIN-SERVER05 Unable to connect N/A
4. Export Windows Uptime to CSV
The same PowerShell output can easily be saved to a CSV file.
$servers = Get-Content ".\servers.txt"
$result = foreach ($server in $servers) {
try {
$os = Get-CimInstance Win32_OperatingSystem `
-ComputerName $server `
-ErrorAction Stop
$uptime = (Get-Date) - $os.LastBootUpTime
[PSCustomObject]@{
Server = $server
LastBoot = $os.LastBootUpTime
Days = $uptime.Days
Hours = $uptime.Hours
Minutes = $uptime.Minutes
Status = "Connected"
}
}
catch {
[PSCustomObject]@{
Server = $server
LastBoot = ""
Days = ""
Hours = ""
Minutes = ""
Status = "Unable to Connect"
}
}
}
$result | Export-Csv ".\Windows_Server_Uptime.csv" -NoTypeInformation
This produces:
Windows_Server_Uptime.csv
5. Check Linux/UNIX Server Uptime
Linux provides several simple commands for checking uptime.
Using uptime
uptime
Example:
08:41:12 up 7 days, 10:25, 2 users, load average: 0.10, 0.15, 0.12
The most useful part is:
up 7 days, 10:25
6. Get Linux Last Boot Time
On modern Linux distributions:
uptime -s
Example:
2026-09-10 08:15:22
You can also use:
who -b
Example:
system boot 2026-09-10 08:15
7. Display Linux Uptime in a Simple Format
echo "Server : $(hostname)"
echo "Last Boot : $(uptime -s)"
echo "Uptime : $(uptime -p)"
Example:
Server : JDESERVER01
Last Boot : 2026-09-10 08:15:22
Uptime : up 7 days, 10 hours, 25 minutes
8. Check Multiple Linux/UNIX Servers Using SSH
If you have five Linux/UNIX servers, create:
servers.txt
Example:
linux01
linux02
linux03
linux04
linux05
Then run:
while read SERVER
do
echo "---------------------------------------------"
echo "Server: $SERVER"
ssh -o ConnectTimeout=5 "$SERVER" '
echo "Last Boot : $(uptime -s)"
echo "Uptime : $(uptime -p)"
'
done < servers.txt
Example output:
---------------------------------------------
Server: linux01
Last Boot : 2026-09-10 08:15:22
Uptime : up 7 days, 10 hours, 25 minutes
---------------------------------------------
Server: linux02
Last Boot : 2026-09-12 14:32:10
Uptime : up 5 days, 4 hours, 8 minutes
9. Create a Clean Linux Uptime Report
For a cleaner operational report:
#!/bin/bash
echo "=============================================================="
printf "%-20s %-25s %-30s\n" "Server" "Last Boot" "Uptime"
echo "=============================================================="
while read SERVER
do
BOOT=$(ssh -o ConnectTimeout=5 "$SERVER" "uptime -s" 2>/dev/null)
UP=$(ssh -o ConnectTimeout=5 "$SERVER" "uptime -p" 2>/dev/null)
if [ -z "$BOOT" ]; then
printf "%-20s %-25s %-30s\n" \
"$SERVER" "Unable to Connect" "N/A"
else
printf "%-20s %-25s %-30s\n" \
"$SERVER" "$BOOT" "$UP"
fi
done < servers.txt
echo "=============================================================="
Example:
==============================================================
Server Last Boot Uptime
==============================================================
linux01 2026-09-10 08:15:22 up 7 days, 10 hours
linux02 2026-09-12 14:32:10 up 5 days, 4 hours
linux03 2026-09-15 06:21:45 up 2 days, 12 hours
linux04 2026-09-01 09:05:31 up 16 days, 9 hours
linux05 Unable to Connect N/A
==============================================================
10. Save Linux Results to a Text File
Use tee to display the results on the screen and save them at the same time:
./check_uptime.sh | tee server_uptime.txt
The output will be displayed on the screen and saved to:
server_uptime.txt
11. Windows vs. Linux Uptime Commands
| Platform | Command | Purpose |
|---|---|---|
| Windows | Get-CimInstance Win32_OperatingSystem | Get OS information |
| Windows | .LastBootUpTime | Get last boot time |
| Windows | (Get-Date) - $os.LastBootUpTime | Calculate uptime |
| Linux | uptime | Display uptime |
| Linux | uptime -p | Display uptime in readable format |
| Linux | uptime -s | Display last boot time |
| Linux/UNIX | who -b | Display system boot time |
| Linux/UNIX | ssh server uptime | Check remote server |
12. Operational Use
Server uptime checks are particularly useful during:
OS patching validation
JDE Tools Release upgrades
WebLogic maintenance
AIS/HTML Server maintenance
Database maintenance
Post-reboot validation
Disaster recovery testing
Production health checks
24x7 Managed Services operations
For example, after a planned maintenance window, you can quickly verify that all servers were actually rebooted and identify any server that was missed.
Conclusion
Checking server uptime does not require manually logging into every server.
For Windows, PowerShell's Get-CimInstance Win32_OperatingSystem provides the last boot time and allows uptime to be calculated.
For Linux/UNIX, commands such as uptime, uptime -s, and who -b provide the required information.
When managing multiple servers, combining these commands with PowerShell remoting or SSH makes it possible to generate a centralized uptime report for the entire environment.
A simple uptime script can therefore become a useful part of a daily CNC / Infrastructure Operations health check.