In this PowerShell script, we will check the system uptime and status of your machine, providing crucial information for system administrators and users alike. By utilizing this script, you can easily monitor your system's performance and identify any potential issues before they escalate. Furthermore, take advantage of ServerEngine to automate this process within your infrastructure. ServerEngine offers seamless integration and automation capabilities that can enhance your workflow and efficiency. With features like remote PowerShell script execution and real-time monitoring, you can ensure that your systems are running optimally with minimal effort. Check out how ServerEngine can transform your administrative tasks into streamlined processes.
$uptime = (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime
$uptimeDateTime = [Management.ManagementDateTimeConverter]::ToDateTime($uptime)
$uptimeSpan = New-TimeSpan -Start $uptimeDateTime -End (Get-Date)
Write-Output "System Uptime: $($uptimeSpan.Days) Days, $($uptimeSpan.Hours) Hours, $($uptimeSpan.Minutes) Minutes"
Write-Output "System Status: $(if ((Get-CimInstance -ClassName Win32_OperatingSystem).Status -eq 'OK') {'Operational'} else {'Non-Operational'})"Run it across your fleet
This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.
More in Monitoring & Health
Disk Space Cleanup and Report Script
2025-01-14User Account Status Reporting Script
2025-01-13Automated Disk Space Monitoring Script
2025-01-13Monitor System Performance with PowerShell
2025-01-12Automating System Health Check with PowerShell
2025-01-05Automate System Performance Monitoring with PowerShell
2024-12-30Ready when you are.
Try ServerEngine free for 7 days.