SCRIPTING - HOW TO CHECK SERVER UPTIME WITH SINGLE COMMAND

If you must check server uptime (or any other information) systeminfo is an interesting command line tool (Windows builtin)

SystemInfo /s SERVERNAME| find "Boot Time:"

With previous command you could obtain remote server uptime information

Indeed concatenating previous commands, using &&, it will aggregate several server info "one shot"

SystemInfo /s SERVERNAME1 | find "Boot Time:" && SystemInfo /s SERVERNAME2| find "Boot Time:"

Consider that you might launch command line, locally, with AD account with enough permissions on remote servers.

[related article]

Scripting - How to refresh remote client ip

[Update - 2022.11.17]

There is an alternative way to check, remotely, system uptime, it is using psexec in conjunction with wmic command.

About psexec you can review this old blog article:

https://www.alessandromazzanti.com/2014/04/psexec-21-download-and-tutorials.html

  1. execute cmd with Administrative rights
  2. cd c:\patchwherepsexecislocated\
  3. PsExec64.exe \\REMOTEPCNAME cmd
  4. wmic path Win32_OperatingSystem get LastBootUpTime