Get-SCOMAlert

Get-SCOMAlert

Gets Operations Manager alerts.

Syntax

Parameter Set: Empty
Get-SCOMAlert [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

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

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

Parameter Set: FromCriteria
Get-SCOMAlert [[-Criteria] <String> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Detailed 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.

Parameters

-ComputerName<String[]>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Credential<PSCredential>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Criteria<String>

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.

Aliases

none

Required?

false

Position?

10

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-HealthState<String[]>

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

Aliases

none

Required?

false

Position?

7

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Id<Guid[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Instance<EnterpriseManagementObject[]>

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.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-LastModifiedBy<String[]>

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.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-Name<String[]>

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

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-Owner<String[]>

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

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-Priority<String[]>

Specifies an array of alert prioirty levels. Valid values are:
-- Low
-- Medium
-- High

Aliases

none

Required?

false

Position?

8

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ResolutionState<Int32[]>

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.

Aliases

none

Required?

false

Position?

5

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-ResolvedBy<String[]>

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.

Aliases

none

Required?

false

Position?

6

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-SCSession<Connection[]>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Severity<String[]>

Specifies an array of severity values of alerts. Valid values are:
-- Information
-- Warning
-- Critical

Aliases

none

Required?

false

Position?

9

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Get all new alerts

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

PS C:\> Get-SCOMAlert -ResolutionState 0

Example 2: Get alerts by using a custom field

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

PS C:\> Get-SCOMAlert | where {$_.CustomField1 -eq "TestServer"}

Example 3: Get alerts and suppress error messages

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 $OrigionalErrorAction 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 $OrigionalErrorAction variable.

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

Example 4: Get an alert by using the ID

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

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

Get-SCOMClassInstance

Set-SCOMAlert

Resolve-SCOMAlert