New-CMRequirementRuleFileAttributeValue
Create a requirement rule to verify file attributes.
Syntax
Default (Default)
New-CMRequirementRuleFileAttributeValue
[-FileArchive <AttributeVerificationOption>]
[-FileCompressed <AttributeVerificationOption>]
[-FileEncrypted <AttributeVerificationOption>]
[-FileHidden <AttributeVerificationOption>]
[-FileReadOnly <AttributeVerificationOption>]
[-FileSystem <AttributeVerificationOption>]
[-InputObject] <IResultObject>
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[<CommonParameters>]
Description
Use this cmdlet to create a requirement rule on an application deployment type that verifies file attributes. For example, Hidden or Read only. It requires a custom global condition of data type File.
Tip
For comparison, if you manually create this requirement rule in the Configuration Manager console, select the following options:
- Category: Custom
- Condition: Select a custom global condition of data type File
- Rule type: Value
- Property: Attributes
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
This example first uses the Get-CMGlobalCondition cmdlet to get a custom global condition. Next it creates the requirement rule object to check that the file has the archive, hidden, and system bits turned on. Finally it passes that rule object to the Set-CMScriptDeploymentType cmdlet to add the requirement.
$myGC = Get-CMGlobalCondition -Name "pagefile.sys"
$myRule = New-CMRequirementRuleFileAttributeValue -GlobalCondition $myGC -FileArchive On -FileHidden On -FileSystem On
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 |
-FileArchive
Set this parameter to On
to verify the Archive bit on the file. By default, the condition doesn't verify the attribute.
Parameter properties
Type: | AttributeVerificationOption |
Default value: | None |
Accepted values: | On, Off, DoNotVerify |
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 |
-FileCompressed
Set this parameter to On
to verify the Compressed bit on the file. By default, the condition doesn't verify the attribute.
Parameter properties
Type: | AttributeVerificationOption |
Default value: | None |
Accepted values: | On, Off, DoNotVerify |
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 |
-FileEncrypted
Set this parameter to On
to verify the Encrypted bit on the file. By default, the condition doesn't verify the attribute.
Parameter properties
Type: | AttributeVerificationOption |
Default value: | None |
Accepted values: | On, Off, DoNotVerify |
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 |
-FileHidden
Set this parameter to On
to verify the Hidden bit on the file. By default, the condition doesn't verify the attribute.
Parameter properties
Type: | AttributeVerificationOption |
Default value: | None |
Accepted values: | On, Off, DoNotVerify |
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 |
-FileReadOnly
Set this parameter to On
to verify the Read only bit on the file. By default, the condition doesn't verify the attribute.
Parameter properties
Type: | AttributeVerificationOption |
Default value: | None |
Accepted values: | On, Off, DoNotVerify |
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 |
-FileSystem
Set this parameter to On
to verify the System bit on the file. By default, the condition doesn't verify the attribute.
Parameter properties
Type: | AttributeVerificationOption |
Default value: | None |
Accepted values: | On, Off, DoNotVerify |
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 custom global condition object to use as the basis for this requirement rule. To get this object, use the Get-CMGlobalCondition cmdlet.
To see the list of available File global conditions at the site, use the following PowerShell command:
Get-CMGlobalCondition | Where-Object DataType -eq "File" | Select-Object LocalizedDisplayName
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 |
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
Related Links
- New-CMRequirementRuleActiveDirectorySiteValue
- New-CMRequirementRuleBooleanValue
- New-CMRequirementRuleCMSiteValue
- New-CMRequirementRuleCommonValue
- New-CMRequirementRuleDeviceOwnershipValue
- New-CMRequirementRuleExistential
- New-CMRequirementRuleExpression
- New-CMRequirementRuleFilePermissionValue
- New-CMRequirementRuleFreeDiskSpaceValue
- New-CMRequirementRuleInputTypeValue
- New-CMRequirementRuleOperatingSystemLanguageValue
- New-CMRequirementRuleOperatingSystemValue
- New-CMRequirementRuleOUValue
- New-CMRequirementRuleRegistryKeyPermissionValue
- New-CMRequirementRuleScreenResolutionValue
- Get-CMGlobalCondition
- Deployment type Requirements
- Create global conditions