Posted on 12-31-2019 06:22 AM
I am trying to determine which of our policies and profiles are assigned and how. I have a script that pulls all of the API data that I need as CSVs. So now I have a list of them and what they are assigned to, but what I really need is to start tracking down ones that aren't really used anymore. To do that, I would like to get a count of systems that are in the groups. Does anyone have a means of doing a data dump via API or SQL a list of groups and count of systems in those groups.
Posted on 12-31-2019 10:58 AM
Just to clarify, are you looking to get a list of all smart / static computer groups and the number of devices within those groups?
Posted on 12-31-2019 12:29 PM
Yeah that is basically it.
Posted on 12-31-2019 01:15 PM
You'll probably want to do this in two steps:
Query the API to get the id number (or name) of all the computer groups. You can do this by using the API Query: /JSSResource/computergroups . It should return a list of all computer groups listing their name and ID number.
Loop through each ID from the above list and query each computer group independently (via API Query: /JSSResource/computergroups/id/<id number>. What you're looking for is the <size> tag (under the parent tag of <computers>) which will contain the number of computers associated with that group.
Hopefully this helps!