Hi @andrew.nguyen
I normally do this with an OS X configuration profile. The restrictions payload has an option to set the desktop background.
On a side note, I generally put the JPG in /Library/CompanyName along with any company specific stuff. Any tmp or system directories may get wiped out by Apple or the vendor.
I do this in 2 steps. One policy that just install the image in /Library/Desktops. Then one policy run this script to set the picture:
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/Custom.jpg"'
I might very well be a login script of you want to set it every time a user logs in.
Hi All,
Thanks for the responses, the script posted by @Joppmann seems to be doing the trick, however it only seems to set the Background Picture of the Primary Display. I'm trying to get this to set all Display's to the defined Desktop Background.
I can't seem to find a way to make the above script work for that, all i can find is...
tell application "System Events" to set picture of every desktop to "/Library/Desktop Pictures/Lion.jpg"
this works if entered in AppleScript / SelfService (Casper) but not if i set as a policy, when reading the logs i get what is seen in the above screenshot,
Thanks for you help on this.
Hi All,
Have been making some progress here,
Have created a policy which runs the "File and Processes" command
osascript -e 'tell application "System Events" to set picture of every desktop to "/Library/Desktop Pictures/Lion.jpg"'
If i enable this in Self Service it works fine, with the below message. (Desktop Pictures on both desktops set)...
[STEP 1 of 4]
Executing Policy Set Desktop Background
[STEP 2 of 4]
[STEP 3 of 4]
Running command osascript -e 'tell application "System Events" to set picture of every desktop to "/Library/Desktop Pictures/Lion.jpg"'...
Result of command:
[STEP 4 of 4]
However if i set it up to run as a recurring task and deploy automatically i get the below...
Executing Policy Set Desktop Background
Running command osascript -e 'tell application "System Events" to set picture of every desktop to "/Library/Desktop Pictures/Lion.jpg"'...
Result of command:
36:104: execution error: An error of type -10810 has occurred. (-10810)
Have tried a number of different variations but always seems to bring back the same result.
The Script offered by Björck appears to work fine either Auto Deployed or Self Service however only sets the image on 1x screen.
Does the error occur when the user is logged in or is it when the Mac is at the login Window?
@andrew.nguyen Is this background to be always set?
Hi Guys,
@davidacland ,I have the script to run at Login & Recurring
@bentoms , Yes we would like to set this as the default background premamently
Cheers
@andrew.nguyen under Configuration Profiles, there is a restrictions payload that can force the desktop.
You'll need to deploy the image, then specify it's path in the profile.