Refresh Self Service via Files and Processes Payload Execute Command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 11-09-2017 07:32 PM
Background
While adding opt-in and opt-out Self Service policies to Jamf Pro 10, we wanted a way to force Self Service to refresh so new testers would immediately see available testing policies.
Script
Add the Files and Processes Payload to your policy, then insert the following code into the Execute Command field:
/usr/bin/su - "`/usr/bin/stat -f%Su /dev/console`" -c "/usr/bin/osascript -e 'tell application "Self Service" to activate' -e 'tell application "System Events" to keystroke "r" using {command down}'"
Self Service should refesh after the policy is executed. (As always, your mileage may vary.)
Related Posts
- Labels:
-
Jamf Pro

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 11-11-2017 08:58 AM
Great tip! Definitely see uses for this. Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 06-13-2019 08:43 AM
Just used this, thanks.
Modified it as follows for forcing the user to view the description, adding in an Esc key press before the refresh:
/usr/bin/su - "`/usr/bin/stat -f%Su /dev/console`" -c "/usr/bin/osascript -e 'tell application "Self Service" to activate' -e 'tell application "System Events" to key code 53' -e 'tell application "System Events" to keystroke "r" using {command down}'"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 07-11-2019 03:44 PM
I made a silly mistake and spent some time trying to figure it out. For the next person that does the same here is my ah-hah moment which is admittedly a "well ya, duh" kind of thing.
If you opted to rebrand Self Service especially the name of the application not just the icon. You will need to change the "Self Service" in the command to "Whatever you renamed Self Service to"... I had added our school districts initials to Self Service in addition to changing the icon to the school logo to make it as familiar as possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-16-2021 09:17 AM
Thanks for your racing-stripe, @kfbbt.
You'll also need the following Privacy Preferences Policy Control settings nowadays:
- Identifier:
com.jamf.management.service
- Identifier Type: Bundle ID
- Code Requirement:
anchor apple generic and identifier "com.jamf.management.service" and (certificate leaf[field.1.2.840.113635.100.6.1.9] / exists / or certificate 1[field.1.2.840.113635.100.6.2.6] / exists / and certificate leaf[field.1.2.840.113635.100.6.1.13] / exists / and certificate leaf[subject.OU] = "483DWKW443")
- App or Service: Accessibility
- Access: Allow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-23-2021 09:54 AM
Has anyone managed to get this to work on Monterey? I am getting the following error, and unfortunately I can't see how to fix it or what causes it "exactly"..
zsh:1: unmatched '
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-27-2021 03:27 AM
@Googolplex The following just worked for me in a single test on macOS 12.0.1 (21A559).
/usr/bin/su \- "`/usr/bin/stat -f%Su /dev/console`" -c "/usr/bin/osascript -e 'tell application \"Self Service\" to activate' -e 'tell application \"System Events\" to key code 53' -e 'tell application \"System Events\" to keystroke \"r\" using {command down}'"
