New-CMComplianceRuleFileFolderSimple

Create a compliance rule for a simple file folder.

Syntax

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.

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

-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

-ExpectedValue

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

Type:String[]
Aliases:ExpectedValues
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ExpressionOperator

For the ExpectedValue, specify the comparison operator.

Type:RuleExpressionOperator
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
Position:Named
Default value:None
Required:True
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

-InputObject

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

Type:ConfigurationItemSetting
Aliases:Setting
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-NoncomplianceSeverity

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

Type:NoncomplianceSeverity
Accepted values:None, Informational, Warning, Critical, CriticalWithEvent
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-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.

Type:SimpleFileFolderProperty
Accepted values:Company, ProductName, SHA1Hash
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ReportNoncompliance

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

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

-RuleDescription

Specify an optional description for this rule.

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

-RuleName

Specify the name for this rule.

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

-WhatIf

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

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

Inputs

Microsoft.ConfigurationManagement.DesiredConfigurationManagement.ConfigurationItemSetting

Outputs

System.Object