Edit

Share via


New-CMRequirementRuleFreeDiskSpaceValue

Create a disk space requirement rule for an application deployment type.

Syntax

Default (Default)

New-CMRequirementRuleFreeDiskSpaceValue
    [-DriverLetter <String>]
    -PartitionOption <PartitionType>
    -RuleOperator <RuleExpressionOperator>
    -Value1 <Int64[]>
    [-Value2 <Int64>]
    [-InputObject] <IResultObject>
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [<CommonParameters>]

Description

Use this cmdlet to create a disk space requirement rule for an application deployment 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 disk space

This example first uses the Get-CMGlobalCondition cmdlet to get the default Disk space global condition. It then creates the requirement rule object to check free space on the E: drive is between 5 MB and 10 MB. Finally it passes that rule object to the Set-CMScriptDeploymentType cmdlet to add the requirement.

$value1 = 5

$value2 = 10

$myGC = Get-CMGlobalCondition -Name "Disk space"

$myRule = $myGC | New-CMRequirementRuleFreeDiskSpaceValue -PartitionOption Special -RuleOperator Between -Value1 $value1 -Value2 $value2 -DriverLetter "E:"

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

-DriverLetter

When you set the PartitionOption parameter to Special, use this parameter to specify the drive letter. For example, "C:".

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

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

In most instances, you'll use the default Disk space global condition, for example: Get-CMGlobalCondition -Name "Disk space".

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

-PartitionOption

Specify the type of partition to evaluate with this requirement rule:

  • Any: Any drive on the device
  • System: The Windows system drive
  • Special: A specific drive. Use the DriverLetter parameter to specify the drive letter.

Parameter properties

Type:PartitionType
Default value:None
Accepted values:Any, System, Special
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

-RuleOperator

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

Parameter properties

Type:RuleExpressionOperator
Default value:None
Accepted values:IsEquals, NotEquals, GreaterThan, GreaterEquals, LessThan, LessEquals, Between
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 an integer or array of expected values to compare. This value is the amount of free space in megabytes (MB).

Parameter properties

Type:

Int64[]

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-CMRequirementRuleFreeDiskSpaceValue -InputObject $GC -PartitionOption System -RuleOperator Between -Value1 1024 -Value2 2048

Parameter properties

Type:Int64
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