Update MEMCM Configuration Item Supported Platform conditions for Windows 11 with PowerShell

Ok, so I’m late to the party but I recently updated MEM Configuration Manager to 2107 and checking the release notes the supported platform conditions for configuration items don’t automatically get updated to include Windows 11 where they’ve been targeted to Windows 10.

I’ve got lots of CIs and I didn’t want to manually update them all, so I put together the script below to automate the process.

It needs to be run where the console is installed and will update all your configuration items that have a Windows 10 condition to include the equivalent W11 condition (not including the 32-bit condition which doesn’t exist for W11).

## Updates MEMCM configuration items with W10 supported platform rules to include the equivalent W11 rule
# Import ConfigMgr Module
Import-Module $env:SMS_ADMIN_UI_PATH.Replace('i386','ConfigurationManager.psd1')
$SiteCode = (Get-PSDrive PSProvider CMSITE).Name
Set-Location ("$SiteCode" + ":")
$CMPSSuppressFastNotUsedCheck = $true
# Define the Windows 10 platform rules to check for
$W10RuleIds = @(
# Get all configuration items
$ConfigurationItems = Get-CMConfigurationItem | Where {$_.LocalizedDisplayName -ne "Built-In"} | Sort LocalizedDisplayName
# Process each…
foreach ($ConfigurationItem in $ConfigurationItems)
Write-Output $ConfigurationItem.LocalizedDisplayName
# Get the package XML, rule nodes and rule ids
[xml]$xml = $ConfigurationItem.SDMPackageXML
$OSRuleNodes = $xml.DesiredConfigurationDigest.OperatingSystem.OperatingSystemDiscoveryRule.OperatingSystemExpression.Operands
[array]$RuleIds = $OSRuleNodes.RuleExpression.RuleId
# Proces each rule id
foreach ($RuleId in $W10RuleIds)
If ($RuleIds -contains $RuleId)
# W10 rule exists
$W11Rule = $RuleId.Replace('10','11')
If ($RuleIds -notcontains $W11Rule)
# Equivalent W11 rule does not exist, so add it
Write-Output "…adding rule '$W11Rule'"
If ($OSRuleNodes.RuleExpression.GetType().BaseType.Name -eq "Array")
$NewNode = $OSRuleNodes.RuleExpression[0].Clone()
$NewNode = $OSRuleNodes.RuleExpression.Clone()
$NewNode.RuleId = $W11Rule
# Commit changes for the item
$ConfigurationItem | Set-CMConfigurationItem DigestXml $XML.OuterXml

Kudos to this sweet PS module which helped me: