Hello!
Can you help me on SCOM?
$mg = Get-SCOMManagementGroup –ComputerName “scom”
$ActiveAlertsView = $mg.GetMonitoringView(“ca3d3bd8-0438-f8d6-12c6-e5936952483c”)
How to get alerts from $ActiveAlertsView ?
Hello!
Can you help me on SCOM?
$mg = Get-SCOMManagementGroup –ComputerName “scom”
$ActiveAlertsView = $mg.GetMonitoringView(“ca3d3bd8-0438-f8d6-12c6-e5936952483c”)
How to get alerts from $ActiveAlertsView ?
Hey
Interesting question. The native cmdlet get-scomalert has no parameter to specify the view. Maybe you can retrieve them with a SQL query though (haven’t tried yet). Is that an option?
Thanks
I think you need to look at the specifik alert view and see how it is scoped. And then retrieve the alerts from the specific class/group and what else conditions that are applied.
Import-Module OperationsManager
$ManagementGroup = “HQSCOM-LB”
New-SCOMManagementGroupConnection -ComputerName $ManagementGroup
$JuniorGroup = @()
$JuniorActiveAlerts = @()
$JuniorActiveAlertProperty = @()
$JuniorGroup = Get-SCOMGroup | Where {$_.DisplayName -like “2ndJunior*”}
#First method
$ClassInstances = @()
$ClassInstances = Get-SCOMGroup -Id $JuniorGroup.Id | Get-SCOMClassInstance
ForEach ($ClassInstance in $ClassInstances)
{
$JuniorActiveAlerts += (Get-SCOMAlert -Instance $ClassInstance.Id -Criteria “ResolutionState = 0 or ResolutionState = 3 and Severity > 0 and Priority > 0”)
}
PS C:\Scripts\scom_alerts> .\JuniorActiveAlerts2.ps1
Get-SCOMAlert : Cannot bind parameter ‘Instance’. Cannot convert the “Microsoft.Linux.Universal.LogicalDisk:Kubesdcmast
er1;/var/lib/docker/overlay2/cbe8882c2bf0930544f6bebd786d9a9ae54976ad4ec54aff052494a7fad6fb31/merged” value of type “Sy
stem.String” to type “Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject”.
At C:\Scripts\scom_alerts\JuniorActiveAlerts2.ps1:16 char:25
Get-SCOMAlert -Instance
How to see what the -Instance parameter means?
Just to be clear, you want to get the active alerts for a specific view. Not all active alerts?