I added the obvious, basic examples below, and even an example function, for those with simpler needs.
What this article is mostly about: For some reason you find yourself wanting to know when a range of servers or workstations were last booted. Here you will find a way of doing it both simply and more advanced against a range of target computers.
I researched the topic a little before writing this article, and I saw various more or less sane ways of determining the last boot-up time, but what I'll be demonstrating here is with WMI from PowerShell, which I think should be a sane approach in most scenarios.
The last time I needed this was when we were deploying some software via a GPO startup script and wanted to see which computers were supposed to have run the script. I already knew about the LastBootUpTime property in the Win32_OperatingSystem class, and considered rolling some one-liners, but realized the very WMI wrapper I had already written would be ideal for taking care of most of the dirty work - and to produce an XML report of the collected data. Later this XML report is turned into CSV and finally we get a readable report.
Lire l'article complet >>