Edit

Share via


New-CMRequirementRuleCommonValue

Create a requirement rule to evaluate a value-based global condition on an application deployment type.

Syntax

Default (Default)

New-CMRequirementRuleCommonValue
    [-PropertyForAssembly <AssemblyProperty>]
    [-PropertyForFileFolder <FileFolderProperty>]
    -RuleOperator <RuleExpressionOperator>
    -Value1 <String[]>
    [-Value2 <String[]>]
    [-InputObject] <IResultObject>
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [<CommonParameters>]

Description

Use this cmdlet to create a requirement rule on an application deployment type that evaluates a global condition with a Value rule type.

After you use this cmdlet, then use one of the Add- or Set- cmdlets for deployment types. Pass this requirement rule object to either the AddRequirement or RemoveRequirement parameters.

For more information, see Deployment type Requirements and Create global conditions.

Note

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

Examples

Example 1: Add a requirement rule for number of processors

This example first uses the Get-CMGlobalCondition cmdlet to get the default Number of processors global condition. Next it creates the requirement rule object to evaluate the global condition on the device to be greater than or equal to two. Finally it passes that rule object to the Set-CMScriptDeploymentType cmdlet to add the requirement.

In other words, the device needs to have at least two processors for the app to install.

$myGC = Get-CMGlobalCondition -Name "Number of processors"
$myRule = New-CMRequirementRuleCommonValue -GlobalCondition $myGC -Value1 "2" -RuleOperator GreaterEquals

Set-CMScriptDeploymentType -ApplicationName "Central app" -DeploymentTypeName "Install" -AddRequirement $myRule

Parameters

-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

-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 global condition object to use as the basis for this requirement rule. To get this object, use the Get-CMGlobalCondition cmdlet.

The global condition needs to support the Rule type of Value.

Parameter properties

Type:IResultObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:GlobalCondition

Parameter sets

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

-PropertyForAssembly

If the global condition supports it, specify the assembly property to compare with the expected value.

Parameter properties

Type:AssemblyProperty
Default value:None
Accepted values:Culture, Version, PublicKeyToken
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

-PropertyForFileFolder

If the global condition supports it, specify a file or folder property to compare with the expected value.

For example:

$myRule = New-CMRequirementRuleCommonValue -GlobalCondition $myGC -PropertyForFileFolder DateCreated -Value1 "2018-08-07T05:32:45Z" -RuleOperator GreaterEquals

Parameter properties

Type:FileFolderProperty
Default value:None
Accepted values:Size, Version, DateCreated, DateModified, Company, ProductName, SHA1Hash, Permissions, Attributes
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

-RuleOperator

Specify the operator to compare the device's setting with the expected value.

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

-Value1

Specify a string or array of expected values to compare.

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

-Value2

If you use a RuleOperator like Between, use this parameter to specify the upper value.

For example:

$myRule = New-CMRequirementRuleCommonValue -GlobalCondition $GC -PropertyForFileFolder Size -Value1 200 -Value2 300 -RuleOperator Between

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

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

Outputs

System.Object