Not sure if this is doable…
If you run
Get-EventLog -Logname System -InstanceID 2147489661 -Newest 1you’ll get the latest ‘uptime’ event from the System Event Log (w2k8/Windows 7).
Is it possible to extract the number of seconds from the ‘Message’ property and assign them to a variable? (i.e. ‘The system uptime is 43 seconds’)
For example, I’d like to be able to say something along the lines of “if $seconds -ge 10800” then to reboot the machine/send an alert etc?