Get-CMComplianceRule

Get a compliance rule for a configuration item.

Syntax

Get-CMComplianceRule
   [-Fast]
   [-Id] <Int32>
   [-PropertyPath <String>]
   [-RuleName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [<CommonParameters>]
Get-CMComplianceRule
   [-Fast]
   -InputObject <IResultObject>
   [-PropertyPath <String>]
   [-RuleName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [<CommonParameters>]
Get-CMComplianceRule
   [-Fast]
   [-Name] <String>
   [-PropertyPath <String>]
   [-RuleName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [<CommonParameters>]

Description

Get a compliance rule for a configuration item. Compliance rules specify the conditions that define the compliance of a configuration item setting. Before the client evaluates a setting for compliance, it must have at least one compliance rule. For more information, see Get started with compliance settings in Configuration Manager.

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Get a compliance rule for a configuration item

Get-CMComplianceRule -Name "BitLocker data drive protection" -RuleName "06 must exist" -Fast

Parameters

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Fast

Add this parameter to not automatically refresh lazy properties. Lazy properties contain values that are relatively inefficient to retrieve. Getting these properties can cause additional network traffic and decrease cmdlet performance.

If you don't use this parameter, the cmdlet displays a warning. To disable this warning, set $CMPSSuppressFastNotUsedCheck = $true.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Id

Specify the CI_ID for the configuration item that has the compliance rule you want to get. For example, 258895.

Type:Int32
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Specify a configuration item object that has the compliance rule you want to get. To get this object, use the Get-CMConfigurationItem.

Type:IResultObject
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specify the name of the configuration item that has the compliance rule you want to get.

Type:String
Aliases:LocalizedDisplayName
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PropertyPath

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RuleName

Specify the name of the compliance rule in the configuration item. This value is the same as the Name value on the Compliance Rules tab of the configuration item properties in the console.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

Microsoft.SystemsManagementServer.DesiredConfigurationManagement.Rules.Rule