I recently wrote an article for the SAGE-AU Newsletter about how much I enjoy scripting using powershell. For the example code I made a script that would use WMI to query the uptime details of a server, and report back on servers that had been up for a minimum number of days.
I have tidied up the code, and it can be downloaded Here
The code now will check to see if the machine(s) are reachable before querying them (WMI has a nasty habit of waiting a long time otherwise. I also implement the QAD-GetComputer version of the script.
This script actually did come in useful this week, as the query found a disturbing number of machines that had been up for more than 90 days (and some more than 250 days) without being patched. Being Windows servers, you can usually safely bet that any server than has not been rebooted after 60 days has not been patched recently…
Work is now being done to rectify this.