Nested Policies / Policy wrapper question

jwng
New Contributor III

We use a "Parent" Policy that calls a script that runs a custom trigger.
Associated "Child" policies use have the custom trigger only. We then use "Child" level smart groups to filter whether or not an asset qualifies for the child policy. Multiple "Children" share the same custom trigger. We use custom prefixes in the policy name and package priority to prioritize delivery. Deferring restarts and post install inventories to a separate child policy that always runs at the end.

My question: Is there a way to display to the user, a the list of the child level smart groups an asset qualifies for (at the parent level) ?

Can I display the policies list (Asset Record>Management>Policies ) albeit an edited version of the asset record to the user? Is there an API command that I can use to grab that data and broad cast it via a JAMFHelper message?

Instance: JAMFCloud

1 REPLY 1

mm2270
Legendary Contributor II

Yeah, actually there is a way to get this in the API. The resource you want is called /computermanagement You can get a list of scoped policies for a given Mac via it's ID, name or other identifiers, by calling a subset of the management tab elements.

Here's an example of pulling the scoped policies on a computer using an ID of 10 for the system.

curl -H "Accept: application/xml" -u 'username:password' https://yourorg.jamfcloud.com/JSSResource/computermanagement/id/10/subset/Policies | xpath '/computer_management/policies/policy/name/text()'

If you want policies that are using a certain trigger, then you'll need to use some grepping or other commands to only pull lines from the full curl output that include the specific trigger. But the above should at least get you on the right track.

Note that you can use something other than the Jamf computer ID for the identifier, like the serial number, UDID or name for example
/JSSResource/computermanagement/serialnumber/{serialnumber}/ /JSSResource/computermanagement/udid/{UUID}/
/JSSResource/computermanagement/name/{name}/