Posted on 12-12-2019 08:54 AM
I have poured through all the threads and found a script that works locally to change the wallpaper of all monitors on a system if run locally. The script however, does not work when pushed through jamf. I get a successful message but not change in the wallpaper. The script I'm using is:
osascript -e 'tell application "System Events" to set picture of every desktop to ("/Users/shared/SISLogo/SIS_WP.jpg" as POSIX file as alias)'
exit 0
I have tried resetting permissions, using PPPC utility to ensure proper Jamf permissions. I get the user message when the script is run but no change to background.
Anybody have an idea?
Posted on 12-12-2019 09:00 AM
The osascript
portion must be run as the logged in user. Since Jamf Pro runs all scripts as root, it's failing.
Try this modification:
#!/bin/bash
loggedinuser=$(stat -f%Su /dev/console)
loggedinuid=$(id -u "$loggedinuser")
/bin/launchctl asuser "$loggedinuid" sudo -iu "$loggedinuser" /usr/bin/osascript -e 'tell application "System Events" to set picture of every desktop to ("/Users/shared/SISLogo/SIS_WP.jpg" as POSIX file as alias)'
exit 0
Also, when posting any kind of script here, be sure to select/highlight the entire script and click the >_
button in the post editing toolbar, so it encloses it in the script markdown and formats it properly for the forums.
Posted on 12-12-2019 09:31 AM
@mm2270 OMG thank you, thank you, thank you.
Out of curiosity on single monitor systems I had used the script:
sudo osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Users/shared/SISLogo/SIS_WP.jpg"'
exit 0
And it changed the wallpaper fine for the primary display. Why did the osascript work in this instance but not for multi monitors?
Posted on 12-12-2019 10:10 AM
If you're saying the second script above for single monitor systems worked as is when deployed from Jamf Pro, then I can't explain that. Generally speaking, when talking about most Applescript/osascript commands that manipulate the user space, they have to be run as the user and not as root. Maybe the single monitor instance operates a little differently, and root is able to make those changes. I'm not sure though.
Posted on 12-12-2019 05:18 PM
Ok. So now I am unable to get the request for permission box to not appear on the user machine. I have created a pppc permission for jamf.app, jamf, and jamf agent with all permissions allowed. I even downloaded the github pppc for system events and still the dialog box pops up. I have heard others having this issue and it's possibly a bug with Jamf?? anybody think anything else?
Posted on 12-14-2019 03:43 AM