WQL query for Device collection of SCOM managemnet servers and/or device collection of SCOM gateways

D D 6 Reputation points
2022-11-10T16:27:23.55+00:00

Hello,

I would like to create a SCCM dynamic device collection that includes SCOM management servers and another one that includes gateway servers? What WQL query I can use for this? are there any queries already available?

Microsoft Configuration Manager
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Garth Jones 1,656 Reputation points MVP
    2022-11-10T16:44:33.717+00:00

    Let me turn this around on you. How do you know SCOM is installed on a computer? Once you answer that we can point you to making the WQL query.

    0 comments No comments

  2. D D 6 Reputation points
    2022-11-10T16:48:19.943+00:00

    Well, that's what I'm trying to figure out. I tried running a query for the Uninstall entry, but it didn't work. So, I was wondering if we have a ready recipe?

    0 comments No comments

  3. Sherry Kissinger 3,801 Reputation points
    2022-11-10T17:53:42.717+00:00

    Based on your reply, you do normally see something when you interactively look at a server, at Programs and Features, correct? Maybe you aren't looking at the "right" thing for CM. If you look in the console, pick a specific server that you personally KNOW has management server and/or gateway server installed, and right-click look at "resource explorer" for that specific device, you should see it listed under "Installed Software".

    If it's not there, look at all of the other things in resource explorer. Potential other ways to "tell" might be if there is a unique service under Services (if you inventory services).

    0 comments No comments

  4. CherryZhang-MSFT 6,481 Reputation points
    2022-11-24T06:59:20.213+00:00

    Hi @D D ,

    I have done some tests and research on your question. We can query it by the special services used by SCOM management servers and gateway servers.

    1, Make sure that the service information is collected by "Hardware Inventory" Client Settings. For example:
    (By default, "Default Client Settings" already contains these. If not, please create it manually)
    263716-picture1.png

    263821-picture2.png

    2, Run hardware inventory to gather service information.

    3, Then run following query:

    > Select SMS_R_System.Name, SMS_G_System_SERVICE.DisplayName from SMS_R_System inner join SMS_G_System_SERVICE on SMS_G_System_SERVICE.ResourceId = SMS_R_System.ResourceId where DisplayName = "Servicename"

    Below is an example with a service, just for your reference:
    263822-picture3.png

    263776-picture4.png

    This thread for your reference:
    SCCM CB | WQL Query to find the specific Service is Running (microsoft.com)

    Looking forward to your feedback.

    Best regards
    Cherry


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.