Get-SCOMAlert
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Get-SCOMAlert
Gets the specified 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> ] [-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 the specified alerts.
Parameters
-ComputerName<String>
Specifies the name of a computer to establish a connection with. The computer must be running the System Center Data Access Service. The default value is the computer for the current management group connection. Valid formats include a NetBIOS name, an IP address, or a fully qualified domain name. To specify the local computer, type the computer name, "localhost", or a dot (.).
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Credential<PSCredential>
Specifies a user account under which the management group connection will run. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or "User@Domain.com", or enter a PSCredential object, such as one returned by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password. For more information, type Get-Help Get-Credential.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Id<Guid>
Retrieves the alert with the specified GUID. The Id is stored in the Id property of the object that represents an alert. 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>
Retrieves alerts for one or more class instance objects. Enter a variable that represents the class instances, or type a command that gets the class instances. This parameter also accepts group objects.
For information about how to get a class instance object, 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>
Retrieves alerts that match the specified user name for the last user that edited the alert.
Aliases |
none |
Required? |
false |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
true |
-Name<String>
Specifies the name of the alerts to retrieve.
Aliases |
none |
Required? |
false |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
true |
-Owner<String>
Retrieves alerts that match the specified owner for the alert.
Aliases |
none |
Required? |
false |
Position? |
4 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
true |
-ResolutionState<Int32>
Retrieves alerts that match a specified resolution state Id. For example, the resolution state Id for "Closed" is 255.
Aliases |
none |
Required? |
false |
Position? |
5 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
true |
-ResolvedBy<String>
Retrieves alerts that match the specified user name for the user that resolved the alert.
Aliases |
none |
Required? |
false |
Position? |
6 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
true |
-SCSession<Connection>
Specifies a connection to a management server. The default is the current management group connection. Specify a Management group connection object, such as one returned by the Get-SCOMManagementGroupConnection cmdlet.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Criteria<String>
Aliases |
none |
Required? |
false |
Position? |
7 |
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
Examples
-------------------------- EXAMPLE 1 --------------------------
Description
-----------
This command gets all alerts with a resolution state of zero (new alerts).
PS C:\>Get-SCOMAlert -ResolutionSate 0
-------------------------- EXAMPLE 2 --------------------------
Description
-----------
This command gets all alerts that have a value of "TestServer" in their CustomField1 property.
PS C:\>Get-SCOMAlert | where {$_.CustomField1 -eq "TestServer"}
-------------------------- EXAMPLE 3 --------------------------
Description
-----------
The first command sets the variable $OrigionalErrorAction to the current value of the $ErrorActionPreference variable.
The second command changes the value of $ErrorActionPreference to "SilentlyContinue". "SilentlyContinue" will allow the following command to continue to run when it encounters a class instance that does not have alerts, and it will not display an error.
The third command gets all classes with "health" in their name and uses the pipeline operator (|) to pass the class objects to the Get-SCOMClassInstance cmdlet which gets the class instances for each class object. It then passes each of the class instance objects to the Get-SCOMAlert cmdlet which returns the alerts that have a resolution state between 5 and 200, inclusive, for each class instance.
The fourth command sets the value for $ErrorActionPreference 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 --------------------------
Description
-----------
This command gets the alert with the Id of 7413b06b-a95b-4ae3-98f2-dac9ff76dabd.
PS C:\>Get-SCOMAlert -Id 7413b06b-a95b-4ae3-98f2-dac9ff76dabd
Related topics
Get-SCOMClassInstance