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.
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!