New-CMRequirementRuleOperatingSystemValue
Create an OS requirement rule for an application deployment type.
Syntax
New-CMRequirementRuleOperatingSystemValue
[-Platform <IResultObject[]>]
[-PlatformString <String[]>]
-RuleOperator <RuleExpressionOperator>
[-SelectFullPlatform <FullPlatformOption>]
[-InputObject] <IResultObject>
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[<CommonParameters>]
Description
Use this cmdlet to create an OS 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 an OS by platform
This example first uses the Get-CMGlobalCondition cmdlet to get the default Operating system global condition for non-mobile Windows devices. It then uses the Get-CMConfigurationPlatform cmdlet to define variables for two platforms for Windows Server 2016 and Windows Server 2019. Next it creates the requirement rule object to include these two platforms. Finally it passes that rule object to the Set-CMScriptDeploymentType cmdlet to add the requirement.
$myGC = Get-CMGlobalCondition -Name "Operating System" | Where-Object PlatformType -eq 1
$platformA = Get-CMConfigurationPlatform -Name "All Windows Server 2019 and higher (64-bit)" -Fast
$platformB = Get-CMConfigurationPlatform -Name "All Windows Server 2016 and higher (64-bit)" -Fast
$myRule = $myGC | New-CMRequirementRuleOperatingSystemValue -RuleOperator OneOf -Platform $platformA, $platformB
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.
In most instances, you'll use the default Operating system global condition for non-mobile Windows devices. For example: Get-CMGlobalCondition -Name "Operating System" | Where-Object PlatformType -eq 1
.
Note
By default, Configuration Manager has two global conditions named Operating system. You can distinguish them by device type using the PlatformType property:
PlatformType | Device type |
---|---|
1 |
Windows |
2 |
Mobile |
Type: | IResultObject |
Aliases: | GlobalCondition |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Platform
Specify an array of one or more OS platform objects. To get this object, use the Get-CMConfigurationPlatform cmdlet.
Type: | IResultObject[] |
Aliases: | Platforms |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PlatformString
Instead of using the Get-CMConfigurationPlatform cmdlet with the Platform parameter, you can use this parameter to specify an array of one or more known ModelName strings. For example, the ModelName for the platform All Windows 11 and higher (64-bit) is Windows/All_x64_Windows_11_and_higher_Clients
.
Use a command similar to the following to discover the model name for a platform:
Get-CMConfigurationPlatform -Name "*Server 2019*" -Fast | Select-Object LocalizedDisplayName, ModelName
Type: | String[] |
Aliases: | PlatformStrings, PlatformCIUniqueID, PlatformCIUniqueIDs |
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: | OneOf, NoneOf |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SelectFullPlatform
Use this parameter to select all platforms of the specified type.
Type: | FullPlatformOption |
Accepted values: | Windows, Nokia, WindowsMobile, IOs, IOsDeepLink, Android, AndroidDeepLink, Mac, WinPhone8, WinPhone8DeepLink, MobileMsi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
Outputs
System.Object
Related Links
- Get-CMConfigurationPlatform
- New-CMRequirementRuleActiveDirectorySiteValue
- New-CMRequirementRuleBooleanValue
- New-CMRequirementRuleCMSiteValue
- New-CMRequirementRuleCommonValue
- New-CMRequirementRuleDeviceOwnershipValue
- New-CMRequirementRuleExistential
- New-CMRequirementRuleExpression
- New-CMRequirementRuleFileAttributeValue
- New-CMRequirementRuleFilePermissionValue
- New-CMRequirementRuleFreeDiskSpaceValue
- New-CMRequirementRuleInputTypeValue
- New-CMRequirementRuleOperatingSystemLanguageValue
- New-CMRequirementRuleOUValue
- New-CMRequirementRuleRegistryKeyPermissionValue
- New-CMRequirementRuleScreenResolutionValue
- Get-CMGlobalCondition
- Deployment type Requirements
- Create global conditions