Computer uptime is an important statistic in systems management. Here are several of the ways we can determine system uptime for a computer (note that this list is by no means exhaustive):

1. The Task Manager’s Performance tab displays the computer uptime as days, hours, minutes and seconds.

2. The Systeminfo command-line tool displays the computer’s last boot time.

3. The most recent event ID 6005 in the computer’s System event log records the computer’s last boot time.

4. The WMI Win32_OperatingSystem class has a LastBootUpTime property that contains the computer’s last boot time.

Each of these techniques has their pros and cons. For example, the Task Manager provides quick visibility for a single computer’s uptime, and the event log contains additional information around the 6005 event that may provide insight about a system failure. The first three choices are probably not the best for automation purposes (e.g., querying a list of servers for uptime), so let’s look to WMI. First, though, we need to take a look at how WMI returns uptime information.