The Microsoft Windows PowerShell script below will query a Windows hosts for the time it was rebooted and the time it completed it’s reboot.

<#
.SYNOPSIS
This script will request the hostname of a server then provide the time it was shutdown and completed it’s reboot.
.DESCRIPTION
This script will request the hostname of a server then provide the time it was shutdown and completed it’s reboot.
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Friday, May 10, 2019.
#>

#Request the hostname of the server
$HOSTNAME = Read-Host “What is the hostname of the server?”

#Message
Write-Host The date and time below indicate the time the server was shutdown -ForegroundColor Green

#Provide the uptime of the server
Get-EventLog -Logname System -ComputerName $HOSTNAME | Where-Object {$_.EventID -EQ 6006} | Select-Object -First 1

#Message
Write-Host The date and time below indicate the uptime of the server -ForegroundColor Green

#Provide the uptime of the server
Get-EventLog -Logname System -ComputerName $HOSTNAME | Where-Object {$_.EventID -EQ 6005} | Select-Object -First 1

#End of script