To build a script that shows us the last system boot time, perform the following steps:
- Launch PowerShell ISE as an Administrator.
- Open up a new script file and input the following line:
Get-WmiObject -Class Win32_OperatingSystem -ComputerName localhost | Select-Object -Property LastBootUpTime
- We have some data! It's kind of messy data, though. Maybe we can clean that up and make it a little more readable. With a couple of changes to our Select-Object code, we can change the header for this data to something more friendly, as well as changing the output of the date and time so it's way easier on the eyes: