This PowerShell script displays the server uptime in a human-readable format. It is designed for Windows Server environments and retrieves the uptime using the Win32_OperatingSystem class.
- Calculates server uptime in days, hours, minutes, and seconds.
- Retrieves the last boot time from the Win32_OperatingSystem class.
- Displays the formatted uptime in the PowerShell console.
- Download or clone this repository.
- Open a PowerShell console with administrative privileges.
- Navigate to the folder where you saved the ServerUptime.ps1 script.
- Type
.\ServerUptime.ps1
and press Enter.
The script will display the server uptime in days, hours, minutes, and seconds.
Server has been running for: 10 days 8 hours 35 minutes 22 seconds
- Windows Server or Windows operating system with PowerShell installed
- Administrative privileges to run the script
Feel free to submit issues, fork the repository, and create pull requests for any improvements, bug fixes, or feature additions.