Created
October 29, 2022 00:45
-
-
Save MrWyss-MSFT/6045d494372aa89c6343d3e2c9b96dee to your computer and use it in GitHub Desktop.
Generates WQL Queries that can be used as GPO WMI filters for Co-Management Workloads (ConfigMgr Version)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Flags()] enum CoManagementFlag { | |
| CoManagementConfigured = 1 | |
| CompliancePolicies = 3 | |
| ResourceAccessPolicies = 5 | |
| DeviceConfiguration = 9 | |
| WindowsUpdatesPolicies = 17 | |
| EndpointProtection = 33 | |
| ClientApps = 65 | |
| OfficeClickToRunApps = 129 | |
| } | |
| foreach( $enumValue in [CoManagementFlag].GetEnumNames() ) | |
| { | |
| Write-host "-----------------------------------------------------------------------------------------------------------------------------------------" | |
| Write-Host "$enumValue workload NOT WQL Query" -ForegroundColor Green | |
| Write-Host "Select ComgmtWorkloads from CCM_System Where `n (ComgmtWorkloads != " -NoNewline | |
| $enumValue = (1..255).where({(($_ -band [CoManagementFlag]::$enumValue) -eq [CoManagementFlag]::$enumValue)}) | |
| $enumValueList = $enumValue | Join-String -Separator ") and `n (ComgmtWorkloads != " | |
| write-host $enumValueList -NoNewline | |
| Write-Host ")" | |
| Write-Host "" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment