Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

New-CMComplianceRuleFileFolderSimple

Create a compliance rule for a simple file folder.

Syntax

Default (Default)

New-CMComplianceRuleFileFolderSimple
 -PropertyType <SimpleFileFolderProperty>
 -ExpressionOperator <RuleExpressionOperator>
 [-ReportNoncompliance]
 -InputObject <ConfigurationItemSetting>
 -RuleName <String>
 [-ExpectedValue <String[]>]
 [-NoncomplianceSeverity <NoncomplianceSeverity>]
 [-RuleDescription <String>]
 [-DisableWildcardHandling]
 [-ForceWildcardHandling]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

Description

Use this cmdlet to create a compliance rule for a simple file folder.

Note

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

Examples

Example 1

$ci = Get-CMConfigurationItem -Name "ci1" -Fast

$Result = $ci | Add-CMComplianceSettingFile -Path "C:\" -FileName "TestFile.exe" -NoRule -Name "AttributeSetting1"

$TestSet = $Result | Get-CMComplianceSetting -SettingName "AttributeSetting1"

$r1 = $TestSet | New-CMComplianceRuleFileFolderSimple -PropertyType SHA1Hash -RuleName "RuleSha1HashEquals" -ExpressionOperator IsEquals -ExpectedValue "s4XuFV2KZldXAMQZ6YEWFv+5zA6ZB982Fbh471TMboc="

$r2 = $TestSet | New-CMComplianceRuleFileFolderSimple -PropertyType Company -RuleName "RuleCompanyEquals" -ExpressionOperator IsEquals -ExpectedValue "Contoso"

$r3 = $TestSet | New-CMComplianceRuleFileFolderSimple -PropertyType ProductName -RuleName "RuleProductNameEquals" -ExpressionOperator IsEquals -ExpectedValue "MyContoso"

$Result | Add-CMComplianceSettingRule -Rule $r1

$Result | Add-CMComplianceSettingRule -Rule $r2

$Result | Add-CMComplianceSettingRule -Rule $r3

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-DisableWildcardHandling

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ExpectedValue

Specify an array of strings to compare the value. The value to compare depends upon the specified PropertyType.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:ExpectedValues

Parameter sets

-ExpressionOperator

For the ExpectedValue, specify the comparison operator.

Parameter properties

Type:RuleExpressionOperator
Default value:None
Accepted values:And, Or, Other, IsEquals, NotEquals, GreaterThan, LessThan, Between, NotBetween, GreaterEquals, LessEquals, BeginsWith, NotBeginsWith, EndsWith, NotEndsWith, Contains, NotContains, AllOf, OneOf, NoneOf, SetEquals, SubsetOf, ExcludesAll
Supports wildcards:False
DontShow:False

Parameter sets

-ForceWildcardHandling

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-InputObject

Specify a configuration item setting object as the target of this rule.

Parameter properties

Type:ConfigurationItemSetting
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Setting

Parameter sets

-NoncomplianceSeverity

Specify the severity level for reports when the rule is noncompliant.

Parameter properties

Type:NoncomplianceSeverity
Default value:None
Accepted values:None, Informational, Warning, Critical, CriticalWithEvent
Supports wildcards:False
DontShow:False

Parameter sets

-PropertyType

Specify the folder property to compare and assess for compliance. Use the -ExpectedValue parameter to specify the value of this property, and the -ExpressionOperator parameter to specify the means of comparison.

Starting in version 2010, the parameter type changed from FileFolderProperty to SimpleFileFolderProperty type.

Parameter properties

Type:SimpleFileFolderProperty
Default value:None
Accepted values:Company, ProductName, SHA1Hash
Supports wildcards:False
DontShow:False

Parameter sets

-ReportNoncompliance

Add this parameter to report noncompliance if this setting instance isn't found.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-RuleDescription

Specify an optional description for this rule.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-RuleName

Specify the name for this rule.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.ConfigurationManagement.DesiredConfigurationManagement.ConfigurationItemSetting

Outputs

System.Object

Related Links


Feedback

Was this page helpful?