New-CMRequirementRuleCommonValue

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

Syntax

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.

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

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

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

-PropertyForAssembly

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

Type:AssemblyProperty
Accepted values:Culture, Version, PublicKeyToken
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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

Type:FileFolderProperty
Accepted values:Size, Version, DateCreated, DateModified, Company, ProductName, SHA1Hash, Permissions, Attributes
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RuleOperator

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

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

-Value1

Specify a string or array of expected values to compare.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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

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

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object