Get-SCOMRule

Get-SCOMRule

Gets Operations Manager monitoring rules.

Syntax

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

Parameter Set: FromManagementPack
Get-SCOMRule [-ManagementPack] <ManagementPack[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromManagementPackClass
Get-SCOMRule [-Target] <ManagementPackClass[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromMonitoringDisplayRuleName
Get-SCOMRule [-DisplayName] <String[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

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

Parameter Set: FromMonitoringRuleName
Get-SCOMRule -Name <String[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Detailed Description

The Get-SCOMRule cmdlet gets monitoring rules for System Center 2012 – Operations Manager.

Parameters

-ComputerName<String[]>

Specifies an array of names of computers. The cmdlet establishes temporary connections with management groups for these 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 started 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

localhost

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies the user account under which the management group connection runs. Specify a PSCredential object, such as one that the Get-Credential cmdlet returns, for this parameter. For more information about credential objects, 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

-DisplayName<String[]>

Specifies an array of display names for objects. This cmdlet takes the strings in this array and looks for matches among the DisplayName properties of the objects that the cmdlet works with. DisplayName values depend on the localized, imported management packs that are part of the management group and the locale of the user who runs Windows PowerShell

If this parameter does not appear, the default description is the one in the Name parameter.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-Id<Guid[]>

Specifies an array of IDs for monitoring rules. The cmdlet gets monitoring rules that match the GUIDs.

An SCOMGroup object stores the GUID in its Id property. To get the GUID of a class, type Get-SCOMGroup | Format-Table DisplayName, Id.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ManagementPack<ManagementPack[]>

Specifies a management pack object that stores overrides. To obtain a management pack object, use the Get-SCOMManagementPack cmdlet. If the rule is in an unsealed management pack, you must save the override into the same management pack.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Name<String[]>

Specifies an array of object names.

This parameter takes each string in the array and looks for matches among the Name properties of the objects that the cmdlet works with.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-SCSession<Connection[]>

Specifies an array of Connection objects. To get Connection objects, use the Get-SCOMManagementGroupConnection cmdlet.

If this parameter is not specified, the cmdlet uses the active persistent connection to a management group. Use the SCSession parameter to specify a different persistent connection. You can create a temporary connection to a management group by using the ComputerName and Credential parameters. For more information, type Get-Help about_OpsMgr_Connections.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Target<ManagementPackClass[]>

Specifies an array of ManagementPackClass objects. To obtain a ManagementPackClass object, use the Get-SCClass cmdlet. The cmdlet gets monitoring rules for these classes.

Aliases

none

Required?

true

Position?

1

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 monitoring rules by specifying names with wildcard

This command gets all monitoring rules that have health in their name.

PS C:\> Get-SCOMRule -Name "*health*"

Example 2: Get monitoring rules by specifying display names with a wildcard

This command gets all monitoring rules with performance in their display name.

PS C:\> Get-SCOMRule -DisplayName "*performance*"

Example 3: Get a monitoring rule by specifying a management pack

This command gets all management packs with System Center Core Monitoring in their display names. It then uses the pipeline operator to send the management pack objects to the Get-SCOMRule cmdlet, which gets the monitoring rules for each management pack object.

PS C:\> Get-SCOMManagementPack -DisplayName "System Center Core Monitoring" | Get-SCOMRule

Example 4: Get monitoring rules by specifying target classes with a wildcard

This command gets the monitoring rules for each target class that has health in its display name.

PS C:\> Get-SCOMRule -Target (Get-SCOMClass -DisplayName "*health*")

Example 5: Get monitoring rules by specifying a management pack with path:

This example gets monitoring rules for a management pack in a specified path.

The first command gets the path to a management pack file and stores it in the $MPFile variable.

The second command uses the ManagementPack parameter to get the monitoring rules from the management pack that is stored in the $MPFile variable.

PS C:\> $MPFile = "D:\Program Files\System Center Operations Manager 2007\Microsoft.SystemCenter.2007.mp"
PS C:\> Get-SCOMRule -ManagementPack $MPFile

Example 6: Get a monitoring rule by specifying a GUID

This command gets the monitoring rule that has an ID of 7413b06b-a95b-4ae3-98f2-dac9ff76dabd.

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

Disable-SCOMRule

Enable-SCOMRule

Get-SCOMClass

Get-SCOMManagementGroupConnection

Get-SCOMManagementPack