Created
October 28, 2022 20:41
-
-
Save MrWyss-MSFT/2eb1b57d115e028ef7e1c011394d602b to your computer and use it in GitHub Desktop.
Generates WQL Queries that can be used as GPO WMI filters for Co-Management Workloads
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 "Enum Value is $enumValue" | |
| Write-Host "Select ComgmtWorkloads from CCM_System Where ComgmtWorkloads=" -NoNewline | |
| $enumValue = (1..255).where({(($_ -band [CoManagementFlag]::$enumValue) -eq [CoManagementFlag]::$enumValue)}) | |
| $enumValueList = $enumValue | Join-String -Separator " or ComgmtWorkloads=" | |
| $enumValueList | |
| Write-Host "" | |
| Write-Host "" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment