Get last reboot time for a host using PowerShell Script

 Here is how we can get the last reboot time for a host using powershell.

Get-WmiObject Win32_OperatingSystem -ComputerName <ip address> | foreach ($_) { [System.DateTime]::ParseExact($_.LastBootupTime.split('.')[0],'yyyyMMddHHmmss',$null) }

Note: You have to replace ip address or hostname to get output.

No comments:

Post a Comment