Tuesday 14 July 2015

When server was rebooted

Create a .txt and write down all your server name like
Server1
Server2
Server3
Save the txt file in safe location. C: ServerProdQaDev.txt
Run the following PowerShell script and see the results when is your server was rebooted
 
 
FOREACH($svr in GC C:\ServerProdQaDev.txt)
{Write-Host $svr “was rebooted on:”
$lastBootUpTime = Get-WmiObject Win32_OperatingSystem -ComputerName $svr | Select -ExpandProperty lastBootUpTime;
[System.Management.ManagementDateTimeConverter]::ToDateTime($LastBootUpTime);}

No comments:

Post a Comment