Share via


Get-SCOMAlert

Gets Operations Manager alerts.

Syntax

Empty (Default)

Get-SCOMAlert
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromAlertId

Get-SCOMAlert
    [-Id] <Guid[]>
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromAlertDefault

Get-SCOMAlert
    [[-Instance] <EnterpriseManagementObject[]>]
    [[-LastModifiedBy] <String[]>]
    [[-Name] <String[]>]
    [[-Owner] <String[]>]
    [[-ResolutionState] <Int32[]>]
    [[-ResolvedBy] <String[]>]
    [[-HealthState] <String[]>]
    [[-Priority] <String[]>]
    [[-Severity] <String[]>]
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromCriteria

Get-SCOMAlert
    [[-Criteria] <String>]
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

Description

The Get-SCOMAlert cmdlet gets one or more alerts. An alert is an indication of a significant event that requires your attention. Rules and monitors can generate alerts.

Examples

Example 1: Get all new alerts

PS C:\>Get-SCOMAlert -ResolutionState 0

This command gets all alerts that have a resolution state of zero (new alerts).

Example 2: Get all non-closed alerts

PS C:\>Get-SCOMAlert -Criteria "ResolutionState != 255 and Severity != 0"

This command gets all alerts that do not have a resolution state of 255 (closed alerts) and the Severity is not Informational.

Example 3: Get alerts by using a custom field

PS C:\>Get-SCOMAlert -Criteria "CustomField1 = 'TestServer'"

This command gets all alerts that have a value of TestServer in the CustomField1 property.

Example 4: Get alerts modified in the last 30 minutes

PS C:\>Get-SCOMAlert -Criteria "LastModified > '$((Get-Date).AddMinutes(-30))'"

This command gets all alerts that have been modified in the last 30 minutes. The time value returned from LastModified is in UTC whereas Get-Date is of Local system time.

Example 5: Get alerts and suppress error messages

PS C:\>$OriginalErrorAction = $ErrorActionPreference
PS C:\> $ErrorActionPreference = "SilentlyContinue"
PS C:\> Get-SCOMClass -Name "*health*" | Get-SCOMClassInstance | Get-SCOMAlert -ResolutionState (5..200)
PS C:\> $ErrorActionPreference = $OriginalErrorAction

This example gets alerts and suppresses error messages for the class instances that do not match the criteria of the command.

The first command stores the value of the $ErrorActionPreference variable in the $OriginalErrorAction variable.

The second command sets the value of the $ErrorActionPreference variable to SilentlyContinue. By setting the value of the $ErrorActionPreference variable to SilentlyContinue, class instances that do not have matching task results continue to run and not show an error.

The third command gets all classes with health in their name and passes the class objects to the Get-SCOMClassInstance cmdlet by using the pipeline operator. The Get-SCOMClassInstance gets the class instances for each class object and passes each of the class instance objects to the Get-SCOMAlert cmdlet. The Get-SCOMAlert cmdlet returns the alerts that have a resolution state from 5 through 200, inclusive, for each class instance.

The fourth command sets the value for the $ErrorActionPreference variable back to the value stored in the $OriginalErrorAction variable.

Example 6: Get an alert by using the ID

PS C:\>Get-SCOMAlert -Id 7413b06b-a95b-4ae3-98f2-dac9ff76dabd

This command gets the alert that has the ID 7413b06b-a95b-4ae3-98f2-dac9ff76dabd.

Parameters

-ComputerName

Specifies an array of names of computers. You can use NetBIOS names, IP addresses, or fully qualified domain names (FQDNs). To specify the local computer, type the computer name, localhost, or a dot (.).

The System Center Data Access service must be running on the computer. If you do not specify a computer, the cmdlet uses the computer for the current management group connection.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

Specifies a PSCredential object for the management group connection. To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.

If you specify a computer in the ComputerName parameter, use an account that has access to that computer. The default is the current user.

Parameter properties

Type:PSCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Criteria

Specifies the criteria XML that indicates how to filter alerts. Criteria can filter on particular rules or monitors, or properties of the alert, but cannot filter on classes or groups. More details can be found here: https://learn.microsoft.com/previous-versions/system-center/developer/bb437603(v=msdn.10)?redirectedfrom=MSDN

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromCriteria
Position:10
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HealthState

Specifies an array of health states. Valid values are: critical (red), warning (yellow), healthy (green).

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAlertDefault
Position:7
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Id

Specifies an array of GUIDs of alert objects. To get the Id of an alert, type "Get-SCOMAlert | Format-Table Name, Id".

Parameter properties

Type:

Guid[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAlertId
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Instance

Specifies an array of class instance objects. This parameter also accepts group objects. To obtain a class instance object, use the Get-SCOMClassInstance cmdlet. For more information, type Get-Help Get-SCOMClassInstance.

Parameter properties

Type:

EnterpriseManagementObject[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAlertDefault
Position:1
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-LastModifiedBy

Specifies an array of user names. The cmdlet get the alerts if the last user that edited the alert matches a user name that you specify.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

FromAlertDefault
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies an array of alert names. The cmdlet get the alerts that match the alert names that you specify.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

FromAlertDefault
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Owner

Specifies an array of user names. The cmdlet gets an alert if the owner of an alert matches a user name that you specify.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

FromAlertDefault
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Priority

Specifies an array of alert prioirty levels. Valid values are:

  • Low
  • Medium
  • High

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAlertDefault
Position:8
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResolutionState

Specifies an array of resolution state IDs.

When an alert is generated, its resolution state is New. Operators can change the resolution state for a new alert to Closed or to a custom resolution state that an administrator has created for the management group. The ID for New is 0 and the ID for Closed is 255. You can assign custom resolution states any value from 2 through 254.

Parameter properties

Type:

Int32[]

Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

FromAlertDefault
Position:5
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResolvedBy

Specifies an array of user names. The cmdlet get the alerts if the user that resolved the alert matches a user name that you specify.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

FromAlertDefault
Position:6
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SCSession

Specifies an array of Connection objects. To obtain a Connection object, use the Get-SCOMManagementGroupConnection cmdlet.

A connection object represents a connection to a management server. The default is the current management group connection.

Parameter properties

Type:

Connection[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Severity

Specifies an array of severity values of alerts. Valid values are:

  • Information
  • Warning
  • Critical

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAlertDefault
Position:9
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.