PowerShell Script to run uptime.exe and compare with date listed on bootstat.dat
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
Answers (0)
Please log in to answer
Be the first to answer this question
$lastbootuptime = Get-CimInstance -ClassName win32_operatingsystem | select lastbootuptime
[datetime]$currenttime = get-date -Format "yyyy-MM-dd HH:mm:ss"
$runningtime = $currenttime - $lastbootuptime.lastbootuptime - martin99 10 years ago