Using PowerShell to view system uptime
I find myself constantly checking servers to figure out what time they last restarted. Usually, this is part of troubleshooting something in order to figure out whether the server rebooted as a planned action or if something went wrong and it restarted on its own during a non-standard time. For years, I had launched Event Viewer, waited for the System logs to open, hoped that they weren't corrupted in some way, and then headed over to noon on the previous day to find the amount of seconds that the system had been online. Then I'd pull out the calculator and do the math on how many days/hours that really was. Way too complicated! Thankfully, we can make calls into WMI objects with PowerShell, and there is ...
Get Windows Server 2012 R2 Administrator Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.