Checking when last booted

Boot Time done four ways

There’s usually more than one way to do things in IT and getting the last boot time in Windows is no different.

Depending on OS Version, version of Powershell if installed, or if wmic is installed, will dictate the command to be used.

Resource: How to Tell if PowerShell is Installed

Below are four ways to get the last boot time on Windows. Two are via PowerShell and two via the Command Prompt.

Powershell command - current

The first Powershell command is for Powershell version 3.

Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime

Powershell command - legacy

This second command is for Powershell versions 1 and 2.

Get-WmiObject win32_operatingsystem | select csname, @{LABEL=’LastBootUpTime’;EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}

Command Prompt - systeminfo

The third command is for Windows 7 or later command prompt.

systeminfo | find /i "Boot Time"

The final command is a wmic command.

This wmic command is the same that is called in the second Powershell above but is called natively at the command prompt. Wmic returns time in UTC.

wmic os get lastbootuptime



Up next 0036-e1000vmxnet3 0038-assembly_adventures_01
Latest posts 0104-change-synology-password-cli 0105-free-git-ebook 0103-using-brew-bundle-to-backup-and-restore-mac-app-store-and-brew-apps Update macOS with an all in one alias Mac App Store Command Line Interface 0100-macos-softwareupdate-cli Markdown Crash Course Video What’s New with Fusion and Workstation [HCP1833] File IO in Python Overview of vSphere 7 Video 0095-what_is_iso Migrating Website HTML details Tag Microsoft RD Client iOS App 0091-create_vmware_esxi_usb_install_media Intel NUC Lab Hosts Hardware Setup 0089-installng_microsoft_sql_2016 Installing the First Two Domain Controllers in the VMware ESXi 6.7 Lab Environment 0088-deploy_vcsa_in_lab Macchanger Utility, and Usage Install a Kali Linux VM in a VMware ESXi 6.7 Environment Install Ubuntu 18.04 Virtual Machine in a VMware ESXi 6.7 Environment Install xRDP on Ubuntu 18.04 Install Chromium on Ubuntu 18.04 Install OpenSSH on Ubuntu 18.04 Install VMware Workstation 14 on Ubuntu 18.04 Nested ESXi server Laboratorium Rattus The Animal Within Who is Veeam? RSAC OnDemand Videos 0075-create_win10_sandbox_vm