Windows Uptime
Last Boot Time
There are multiple ways to report Windows last boot time...
Powershell
Get-CimInstance Win32_OperatingSystem | Select-Object LastBootUpTime
Get-WinEvent -ProviderName EventLog | Where-Object {$_.Id -eq 6005 -or $_.Id -eq 6006} | Select-Object -First 1 TimeCreated
Get-WinEvent -ComputerName localhost -FilterHashtable @{logname = 'System'; id = 1074} -MaxEvents 1 | format-list
TimeCreated : 07/05/2023 04:24:37ProviderName : User32Id : 1074Message : The process C:\Windows\servicing\TrustedInstaller.exe (MYHOSTNAME) has initiated the restart of computer MYHOSTNAME on behalf of user NT AUTHORITY\SYSTEM for the following reason: Operating System: Upgrade (Planned) Reason Code: 0x80020003 Shutdown Type: restart Comment:
WMI
wmic os get lastbootuptime
systeminfo
systeminfo | find "System Boot Time:"
Net Statistics
net stats srv
Note that in my testing of this method, the date was consistent with other methods above but time was notUptime
Powershell
Install
Install-Script -Name Get-ServerUptimeReport
Run
For a single server...
./Get-ServerUptimeReport.ps1 -ComputerName myServer
For multiple servers...
$servers = 'myServer1','myServer2'
foreach ($server in $servers) {
Get-ServerUptimeReport.ps1 -ComputerName $server | Select-Object -Property *,@{n='ServerName';e={$server}}
}
Task Manager
Performance tab, CPU page
Bibliography
https://adamtheautomator.com/check-windows-server-uptime/https://adamtheautomator.com/get-winevent/https://www.technipages.com/windows-10-how-to-see-system-uptimehttps://techcommunity.microsoft.com/t5/windows-server-for-it-pro/is-my-server-pending-reboot/m-p/2087115https://stackoverflow.com/questions/1059663/is-there-a-way-to-wordwrap-results-of-a-powershell-cmdlet
Toolshttps://neosmart.net/uptime/