I'm looking for a powershell script that will call uptime.exe and compare the output to the date/time stamp on the boostat.dat file in c:\Windows directory.  This is needed to run remotely on several servers and can be then activated through a 3rd party tool for operational management of Windows 2003/2008/& 2012 servers.

1 Comment   [ + ] Show comment


  • # Requires PowerShell 3.0
    $lastbootuptime = Get-CimInstance -ClassName win32_operatingsystem | select lastbootuptime

    [datetime]$currenttime = get-date -Format "yyyy-MM-dd HH:mm:ss"

    $runningtime = $currenttime - $lastbootuptime.lastbootuptime

There are no answers at this time