Edit

Share via


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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RuleDescription

Specify an optional description for this rule.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RuleName

Specify the name for this rule.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

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