Downtime in a SQL Server

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

  • Unplanned downtime is downtime that occurs as a result of a failure. In contrast, planned downtime is downtime that occurs when an administrator shuts down the system at a scheduled time. To remove or minimize planned downtime, you can implement server clustering. 
    192.168.1.1