Skip to content
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report

How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report

Written By Rajul OS
Last Updated August 8, 2024
Posted In SCCM
SHARE

Let’s see how to identify the devices that are connected to SCCM infra via Cloud Management Gateway. In this post, I shall provide the details of the WQL and SQL queries to Identify Devices Connected via SCCM CMG.

Introduction SCCM Cloud Management Gateway (CMG) is an Internet client management feature introduced by Microsoft as a pre-release feature in ConfigMgr CB 1610.

This feature simplifies management and reduces the complex configuration required to implement Internet-based client management (IBCM with reverse proxy).

With the release of the Co-Management feature in ConfigMgr CB 1710, the Cloud Management gateway plays an important role in transitioning from traditional management to modern management.

Patch My PC

Related Post Fix SCCM Client CMG Communication Failure Error 0x87d0027e | ConfigMgr.

One of the major questions that arose after the successful implementation of the Cloud Management Gateway was, “How can I identify the machines connected via SCCM Cloud Management Gateway?”

It’s challenging to Identify the machines connected to the Internet via Cloud Management Gateway. Initially, the machines were identified by querying the last scan package source location update using the query below.

select count(*) as count,LastScanPackageLocation
   from v_updatescanstatus
   group by LastScanPackageLocation
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report - Fig.1
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report – Fig.1

This query gives the machines scanned SUP from the intranet and the internet. However, we cannot find the last time these machines were online or connected via the cloud management gateway.

With the release of ConfigMgr CB 1710, Microsoft updated the schema to include the status of machines connected via Cloud Management Gateway. Similar to the client’s online/offline status, a new status is available for the client machines to monitor the Internet status and online Management Point name.

Add respective fields
Device Online From Internet
Device Online Management Point
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report – Table 1

Add respective fields (Device Online From Internet & Device Online Management Point)

How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report - Fig.2
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report – Fig.2

Collection Members view after adding the fields mentioned above.

How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report - Fig.3
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report – Fig.3

How to Create a Collection to Find Out CMG Connected Devices

This information would be more helpful if we could create a collection based on Device Online from Internet criteria. Use the below WQL query to create a collection based on Device Online from Internet status.

Download the WQL Query for collection How-to-Create-Collection-to-Find-out-CMG-Connected-Devices/How to Create Collection.sql at main · AnoopCNair/How-to-Create-Collection-to-Find-out-CMG-Connected-Devices (github.com)

Create the collection with incremental updates that are to be updated automatically when the machines connect from the intranet or the Internet.

Identify Devices Connected via SCCM CMG - Cloud Management Gateway ConfigMgr
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report – Fig.4

Once the collection is ready, if the admins want to restart the machines connected via the cloud management gateway, they can use the latest feature introduced in ConfigMgr 1710. Restart works perfectly on machines connected via the SCCM cloud management gateway.

How to Create the SSRS or SQL Reports to Find Out CMG Connected Devices

The same information can be queried from the CM database as well. If your management asks for a report of online machines from the Internet, an SSRS report can be created to pull this information. Use the below SQL query to pull the information.

select Name, SiteCode, ClientVersion, LastPolicyRequest, LastDDR as [Last Heartbeat],
LastHardwareScan, max(CNLastOnlinetime) as [Last Online Time],
max(CNLastOfflineTime) as [Last Offline Time], CNAccessMP as [Internet Access MP]
from v_CollectionMemberClientBaselineStatus
Where CNIsOnInternet =1
group by Name, SiteCode, ClientVersion, LastPolicyRequest, LastDDR,
LastHardwareScan, CNLastOnlinetime, CNLastOfflineTime, CNAccessMP
order by CNLastOnlineTime desc
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report - Fig.4
How to Identify Devices Connected via SCCM CMG | ConfigMgr | Custom Report – Fig.4

References:

  1. How to export database schema
  2. What’s new in ConfigMgr 1710
  3. Cloud Management Gateway
  4. All Co-Management Video tutorials are in one post here.

We are on WhatsApp now. To get the latest step-by-step guides, news, and updates, Join our Channel. Click here. HTMD WhatsApp.

Author

Anoop C Nair is Microsoft MVP from 2015 onwards for consecutive 10 years! He is a Workplace Solution Architect with more than 22+ years of experience in Workplace technologies. He is a Blogger, Speaker, and Local User Group Community leader. His main focus is on Device Management technologies like SCCM and Intune. He writes about technologies like Intune, SCCM, Windows, Cloud PC, Windows, Entra, Microsoft Security, Career, etc…

Written by

Rajul is a Technical Architect with more than 12 years of experience in System Center Configuration Manager and has hands-on experience in SCOM, SCVMM, SCEP, SQL, Azure, Intune etc. His main area of interest is design and implementation of ConfigMgr and OpsManager Infrastructure. He is having a vast knowledge of ConfigMgr infrastructure & Client side troubleshooting.

Discussion · 9 comments

  1. Is there a way to get a list of clients and the MP’s they’re connected to when they are connected via IBCM?

  2. This is what i was looking for. Thanks for the post.
    I still have some confusion on the machines count which is reporting to CMG. You have give great idea so I can research more from here. Thanks

  3. Thx for thoose reports but it seems to me that they show the client connected on “internet mode”, and not to the CMG this is different

  4. Thank you for putting this together. I’m struggling to add a Collection parameter. I’ve tried a couple of tutorials with no luck.

  5. is there a way to find machines which are connected to CMG in last 30 days

    Please share if you have any query , i am unable to find .

Join the discussion

Your email address will not be published. Required fields are marked *

Related guides

Intune

Windows 11 KB5101650 KB5099414 July 2026 Patch and 3 Zero Day Vulnerabilities and 570 Flaws

Key Takeaways Windows 11 KB5101650 KB5099414 July 2026 Patch and 3 Zero Day Vulnerabilities and 570 Flaws! In the July 2026 Patch, Microsoft introduced new features designed to improve the overall Windows experience. The update adds enhancements to Windows Update for more flexible update management and introduces Point-in-Time Restore, providing an additional recovery option for […]

AC Anoop C Nair 9 min read
Intune

2026 June KB5094126 KB5093998 Windows 11 Patch | 3 Zero Day Vulnerabilities and 200 Flaws

Key Takeaways 2026 June KB5094126 KB5093998 Windows 11 Patch | 3 Zero Day Vulnerabilities and 200 Flaws! The June 2026 Windows 11 Patch Tuesday update brings several improvements to File Explorer. It adds support for additional archive formats, including UU, CPIO, XAR, and NuGet Packages (NUPKG). The update also preserves View and Sort preferences in […]

AC Anoop C Nair 10 min read
Intune

2026 May KB5089549 KB5087420 Windows 11 Patch | 0 Zero Day Vulnerabilities and 120 Flaws

Key Takeaways The Windows 11 May 2026 Patch KB5089549 KB5087420 Update brings important security fixes, performance improvements, and reliability enhancements across the operating system. The update introduces new features such as Xbox Mode for gaming, File Explorer improvements, enhanced input and sharing experiences, better taskbar and Windows Hello reliability, and additional enterprise management capabilities for […]

AC Anoop C Nair 8 min read
SCCM

ConfigMgr 2603 Introduces New Early Update Enrollment Process

Key Takeaways In this post we are discussing the ConfigMgr 2603 Introduces New Early Update Enrollment Process. Microsoft has officially released Configuration Manager version 2603 to the Early Update Ring, giving organizations an opportunity to test upcoming improvements before the global production rollout. The release is targeted at enterprises running ConfigMgr version 2409 or later […]

AC Anoop C Nair 3 min read