SCCM check software from SQL query

Eaven HUANG 2,191 Reputation points
2023-01-12T09:09:36.3766667+00:00

Dear experts,

Can we run query in SCCM SQL server to check if a certain collection of devices has a specific software or not? For example, we need to check if the devices have been installed with Python, no matter if the devices are on or offline.

I knew that we can start CMPivot to check the information in realtime but most of the devices don't really stay online all the time.

Is it possible?

Microsoft Security Intune Configuration Manager Application
Microsoft Security Intune Configuration Manager Other
0 comments No comments
{count} votes

Accepted answer
  1. AllenLiu-MSFT 49,311 Reputation points Microsoft External Staff
    2023-01-17T02:27:16.93+00:00

    Hi, @Eaven HUANG

    Thank you for posting in Microsoft Q&A forum.

    Yes, it's easy to filter the device that has Python installed from a certain collection, please try the SQL query, remember to replace the collection ID with your own collection ID:

    select distinct Name0,DisplayName0 from v_Add_Remove_Programs 
    inner join v_r_system
    on v_r_system.ResourceID=v_Add_Remove_Programs.ResourceID
    inner join v_ClientCollectionMembers
    on v_ClientCollectionMembers.ResourceID=v_r_system.ResourceID
    where v_Add_Remove_Programs.DisplayName0 like '%Python%'
    and v_ClientCollectionMembers.CollectionID='PRI00014'
    

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Add comment".

    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.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Garth Jones 1,366 Reputation points
    2023-01-12T11:30:21.1733333+00:00

    Yes there is already built in reports for this, take a look at them.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.