Downtime in a SQL Server

by Jun 6, 2017

Hi folks I am trying to find planned and unplanned downtime in some of our key servers.

This is what I have so far: 

$IDS=(3449, 7034)
foreach($ID in $IDS)
{
$UnPlannedShutDown=get-winevent -FilterHashtable @{Logname='Application';ID=$ID} -MaxEvents 1
}
foreach ($item in $UnPlannedShutDown){Write-Host $item.timecreated, $item.message}

 

IDs 3449 and 7034 in the event logs. 3449 is in Application Log and 7034 is in System log. Not sure how I would loop through this without getting errors.

P.S. I am fairly new to all this.

Regards

Paresh Motiwala