Compliance Settings are business or technical conditions to assess compliance of a device. There may be a requirement to quickly identify compliant or non compliant devices to perform quick troubleshooting or other activities and a SCCM dynamic collection is much helpful in this scenario. You can follow the below steps to create dynamic collection based on configuration baseline compliance status.
Note: We will cover about WQL queries to create collection based on compliance baselines. If you are looking for step by step process to create a dynamic / query based collection then follow this article : How to Create Dynamic Collection in SCCM
WMI Server Class for Configuration Baseline Compliance Status
SMS_G_System_DCMDeploymentState is a WMI server class which store information about SCCM Configuration baseline compliance status. The name DCM stands for Desired Configuration Manager which was earlier name for Compliance Settings.
The WQL query can be created from Configuration Manager Query Designer or you can simply copy the query provided below and paste the same directly in query editor.
Attributes to select from Query Designer
If you are using Collection query designer then select the below Attribute class. The Attributes need to be selected as per your requirements. Otherwise, you can copy and use the WQL queries provided below.
Attribute Class : DCM Deployment State
Attributes:
- Baseline CI Unique ID
- Collection ID
- Compliance State
- Resource ID
- Resource Name
How to find Baseline CI Unique ID
- In the Configuration Manager console, navigate to Asset and Compliance > Compliance Settings > Configuration Baseline
- Right click on the column header and select CI Unique ID column
- Note down the CI Unique ID for Configuration baseline which collection you want to create
SCCM Dynamic Collection Query for Non Compliant Devices for a Configuration baseline
The below WQL query will include all computer in collection which are non-compliant against a baseline. You simply need to update the Baseline Unique ID in below query.
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_DCMDeploymentState on SMS_G_System_DCMDeploymentState.ResourceId = SMS_R_System.ResourceId where SMS_G_System_DCMDeploymentState.BaselineID = "ScopeId_C7759691-9263-5AE1-9DFD-F1A9327838A7/Baseline_85409a7c-0ae1-434e-b3e3-ef40f6ac654" and SMS_G_System_DCMDeploymentState.ComplianceState != "1"
SCCM Collection Query for Compliant Devices for a Configuration baseline
The below WQL query will include all computers in collection which are compliant against a baseline. You need to update the CI Unique ID in below query.
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_DCMDeploymentState on SMS_G_System_DCMDeploymentState.ResourceId = SMS_R_System.ResourceId where SMS_G_System_DCMDeploymentState.BaselineID = "ScopeId_C7759691-9263-5AE1-9DFD-F1A9327838A7/Baseline_85409a7c-0ae1-434e-b3e3-ef40f6ac654" and SMS_G_System_DCMDeploymentState.ComplianceState "1"
Related Posts
- How to Create Dynamic Collection in SCCM
- Enclosure Chassis Types Value & Description | ConfigMgr | SCCM
- ConfigMgr: Maintenance Window for member of specific collection – SQL Query
- SCCM Dynamic Collection for Windows 10 / 11 Devices
- SCCM Device Collection Equivalents in Microsoft Intune for App Deployment
- SCCM Dynamic Collection Based on Device Type | Collection Queries
- SCCM Collection Based on Operating System Optional Features
- SCCM Device Collection Based on Installed Software Products & Inventoried Files
- SCCM Device Collection Based on Computer Hardware Details
- SCCM Collection Queries for Opearting System Attribute Class
- SCCM Collection Queries for System Resource (SMS_R_System) Attribute Class
- SCCM Dynamic Collection using Application Deployment Status
- SCCM Dynamic Collection Based on Configuration Baseline Compliance Status
- How to Create , View and Organize SCCM Maintenance Windows
- How to Provision Windows 10 / 11 Device using Intune and Windows Autopilot
Subscribe to Techuisitive Newsletter
Be the first to know about our new blog posts. Get our newsletters directly in your inbox and stay up to date about Modern Desktop Management technologies & news.