Skip to main content
Question

Refresh Self Service via Files and Processes Payload Execute Command


dan-snelson
Forum|alt.badge.img+28

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

@rhs615's Command to Refresh Self-Service

@timdambrosio's Self Service refresh/home via command line

6 replies

Forum|alt.badge.img+13
  • Contributor
  • 35 replies
  • November 11, 2017

Great tip! Definitely see uses for this. Thank you.


Forum|alt.badge.img+6
  • New Contributor
  • 17 replies
  • June 13, 2019

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}'"

Forum|alt.badge.img+3
  • New Contributor
  • 7 replies
  • July 11, 2019

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.


dan-snelson
Forum|alt.badge.img+28
  • Author
  • Honored Contributor
  • 632 replies
  • January 16, 2021

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


Forum|alt.badge.img+2
  • New Contributor
  • 3 replies
  • October 23, 2021

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 '

dan-snelson
Forum|alt.badge.img+28
  • Author
  • Honored Contributor
  • 632 replies
  • October 27, 2021
Googolplex wrote:

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 '

@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}'"

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings