SCRIPTING - HOW TO CHECK SERVER UPTIME WITH SINGLE COMMAND #part 2

In previous article I mentioned a way to check remote client/server uptime.

https://www.alessandromazzanti.com/2022/03/scripting-how-to-check-server-uptime.html

An alternative way is to execute these powershell commands:

$serverName = "NomeDelServer"

$uptime = (Get-WmiObject -Class Win32_OperatingSystem -ComputerName $serverName).ConvertToDateTime((Get-WmiObject -Class Win32_OperatingSystem -ComputerName $serverName).LastBootUpTime)

$uptime