I don't believe the API has the ability to pull that information as far as I can tell. The policy API only appears to allow you to configure or read the policy itself, not its logs.
Yes, unfortunately @alexjdale is correct. The API can't currently pull any stats from the policy. I really wish it could.
However, its possible to get at least some of this information by crafting things in your JSS the right way.
As an example, if you create 2 Smart Groups, one that is used for a policy scope, and the other for any Macs that are already compliant with what your policy is trying to do, you can get data on Macs that both meet and don't meet the criteria.
Let's use Flash Player as an example.
For Smart Group 1, we can add criteria that would gather all Macs that are not already running Flash Player 18.0.0.232. Add whatever other criteria you might need as well, such as check in time range, or locations, etc.
For Smart Group 2, you can add in criteria to gather any Macs that are running Flash Player 18.0.0.232, and perhaps that have installed it from your policy by looking for the specific Casper package receipt.
Scope your Flash Player policy to Smart Group 1, and just let Smart Group 2 hang out, collecting Macs that fall into its criteria range.
Later as your policy is deploying, you can pull the Smart Group membership of each group and pull data like computer names and other details, or, perhaps just a total of the group membership from each one. You can script comparing these 2 numbers to come up with a compliance % number. For example:
- Get a total of all Macs by adding compliant and non-compliant numbers together
- Divide the compliant number by the total number above and then multiply by 100 to get a percentage
I'm already doing something along these lines to generate an email with compliancy numbers for some of our security related policies.
Unfortunately, this would only address your first 2 bullet points - "How many assets completed running the policy" and "How many assets remaining" It won't do anything for how many have failed running the policy since that can only be viewed in the policy log, not accessible in the API.
Funny you mention that exact policy :)
But while it does not solve my problem, I feel better knowing that it is something that exactly be done through the Api and not me losing my mind towards the end of the day.