Get-SCOMAlert
Gets Operations Manager alerts.
Syntax
Get-SCOMAlert
[-SCSession <Connection[]>]
[-ComputerName <String[]>]
[-Credential <PSCredential>]
[<CommonParameters>]
Get-SCOMAlert
[-Id] <Guid[]>
[-SCSession <Connection[]>]
[-ComputerName <String[]>]
[-Credential <PSCredential>]
[<CommonParameters>]
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>]
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.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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
Type: | String |
Position: | 10 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-HealthState
Specifies an array of health states. Valid values are: critical (red), warning (yellow), healthy (green).
Type: | String[] |
Position: | 7 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Id
Specifies an array of GUIDs of alert objects.
To get the Id of an alert, type "Get-SCOMAlert | Format-Table Name, Id
".
Type: | Guid[] |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | 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
.
Type: | EnterpriseManagementObject[] |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | 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.
Type: | String[] |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
-Name
Specifies an array of alert names. The cmdlet get the alerts that match the alert names that you specify.
Type: | String[] |
Position: | 3 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
-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.
Type: | String[] |
Position: | 4 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
-Priority
Specifies an array of alert prioirty levels. Valid values are:
- Low
- Medium
- High
Type: | String[] |
Position: | 8 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | Int32[] |
Position: | 5 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
-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.
Type: | String[] |
Position: | 6 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
-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.
Type: | Connection[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Severity
Specifies an array of severity values of alerts. Valid values are:
- Information
- Warning
- Critical
Type: | String[] |
Position: | 9 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |