Long for the days on linux where you just wanted to type ‘uptime’ to find out when server was last rebooted.

Here’s a powershell equivalent

(get-date) - (gcim Win32_OperatingSystem).LastBootUpTime 

To be honest, that is a pain. Lets create it as a function and set it as an alias

 function UP {(get-date) - (gcim Win32_OperatingSystem).LastBootUpTime}
Set-Item -Path Alias:uptime -Value UP

Now I just type ‘uptime’ and I’m much happier.

Windows uptime in powershell
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *