Posted on 02-23-2017 03:28 PM
I have a request from our communications departing requesting that we change our background picture for all domain users. Has anyone successfully done this on either El Capitan or Sierra?
Posted on 02-23-2017 07:58 PM
@ewaddy Yes am doing this on both OS.
Download a image file to somewhere on the client computer, then invoke a script to load on login using that image file.
our script below:
# This script changes the Apple Mac OSX wallpaper in 10.10 for the current user
# to Earth Horizon - feel free to set a different JPEG or download, then set it!
# Cribbed from this answer: http://stackoverflow.com/a/2119076
#
# "/Library/Desktop Pictures/Earth Horizon.jpg" (org)
#
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/UTAS/utastri.jpeg"'
Posted on 02-24-2017 07:04 AM
@dmw3 I get an error when I run the script the error is below
Here is the script I ran.
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/hutower.jpg"'
Posted on 02-24-2017 12:39 PM
You can create a configuration profile to enforce a desktop background picture. I had this in place at one point.
Posted on 03-02-2017 02:19 PM
That was my solution in tandem with deploying the .jpg file itself.
I dropped the file inside a folder (this can go pretty much anywhere but best if out of the users reach) then dropped the folder in composer to create a .pkg install.
My policy pops the file in place and a config profile pointing to that file enforces the wallpaper.
You can scope this in many ways, I scoped mine to our loaners so they all say "bring me back, for temporary use only.
Posted on 02-05-2018 01:50 AM
Hello, I am resurrecting this old thread... Sorry if it has already been discussed/solved but could not find it...
I have tried using Greg Neagle's desktop_picture.mobileconfig but - despite the profile works perfectly locally (manually installed) - once distributed with JSS I get an empty profile on the clients (10.12.6), please see pictures below.
What am I missing?
I would rather use a profile limited to the desktop picture instead of the whole "Restrictions" profile in JSS.
Many thanks for your help!!!
Posted on 02-06-2018 05:06 AM
I packaged the image I wanted as the background to /Library/Desktop Pictures/filename.jpg
created this script to run with the priority after to change the ownership and set the background image.
chown root:wheel /Library/Desktop Pictures/filename.jpg
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/filename.jpg"'
Has worked flawlessly for a year now. Hope this helps.
Shaun
Posted on 02-07-2018 05:48 AM
Hello and many thanks for your message. I tried your script and it works fine but clients can still change their desktop picture once set...
...unless (very likely) I am missing something obvious... only now I am realising I did not mention the goal of preventing users from changing the picture :-)
Anyway, for now I am using Greg Neagle's desktop_picture.mobileconfig distributed manually along with the chosen picture and installed with
Run Unix command '/usr/bin/profiles -IF /private/tmp/desktop_picture.mobileconfig'
If I will ever need to remove it, it only takes distributing the profile itself again and running
Run Unix command '/usr/bin/profiles -R -F /private/tmp/desktop_picture.mobileconfig'
Any smarter solution always welcome!!!
Many thanks again
Carlo
Posted on 02-07-2018 08:33 AM
• Is there a way to target multiple displays? I noticed the AppleScript above only sets the wallpaper on the primary monitor when executed on Macs with multiple-monitor configurations.
• Since this script envokes the macOS Finder, can this script be ran on Macs that don't have a console user logged-in at time of execution (i.e sitting idle at the macOS Login Window)?
Posted on 02-07-2018 08:45 AM
@carlo.anselmi
I think the best way is to use a configuration profile to lock the desktop background.
You can find that option under the Functionality section when setting up or modifying a configuration profile.
Here is a SS:
@dstranathan We have no macs that require us to set the background for a second display. I will see if I can find something and get back to you.
Shaun
Posted on 02-07-2018 09:27 AM
Jamf fulfilling this feature request would simplify this issue.
Posted on 02-08-2018 06:18 AM
Hello everyone, what milesleacy highlights is exactly the reason I decided to use a profile with just one restriction (despite I am not that happy the way I had to manage it...).
Thank you all!
Posted on 11-12-2018 03:17 AM
Hello - I was hoping to confirm how a new desktop background can be deployed via jamf into Library/Desktop Pictures/
Im hoping to push a new background some macs, either using a config profile or policy (or both). The user can change this background if they so wish so it doesnt need to be locked down
Has anyone successfully done this and also how?
Posted on 11-12-2018 04:32 AM
@kingrebel, If you are looking to put the image files on the Macs disk then either you will need to package them or host them on a web server and download them via script. Deploying the files should be considered a separate process to actually setting the desktop, by the sounds of it you want the desktop picture to be set once per user, likely on login, however this isn't the frequency or scope for how you would ideally deploy the images.
Posted on 11-12-2018 06:49 AM
@dstranathan below works for us... shows on all displays.
osascript -e 'tell application "System Events" to set picture of every desktop to ("/Library/Desktop Pictures/Wallpaper.jpg" as POSIX file as alias)'
Posted on 01-11-2019 12:07 PM
Please mark @__Uss 's comment as the correct answer it will save people a lot of time searching the interwebs.
Posted on 01-14-2019 05:35 AM
I have a LaunchAgent that runs at log in. It sets the Desktop Background to the Files I specify. I can also set the two displays to be the same or unique pictures. Yes users can change their picture, but it will reset next time they log in, after a couple of rounds of this I find that they give up.
A couple of things to note. Make the Picture the same size as the Apple ones. Put it in the /Library/DesktopPictures folder. If you try to be tidy and put it in a folder in there it will not resize to fit on the screen.
My script sets the pictures location in bash. And then goes into AppleScript to set the backgrounds. So in the script below $maindisp and $secdisp are the file locations set by the bash script, this allows me to run different pictures based on location of the Mac.
/usr/bin/osascript << EOF
set tlst to {}
set newtop1 to (do shell script "/bin/echo '$maindisp'") as alias
set newtop2 to (do shell script "/bin/echo '$secdisp'") as alias
tell application "System Events"
ignoring application responses
set tlst to a reference to every desktop
set picture of item 1 of tlst to newtop1 -- display 1
set picture of item 2 of tlst to newtop2 -- display 2
end ignoring
end tell
EOF
Posted on 02-22-2019 08:14 AM
@__Uss Thank you so much!
Posted on 03-04-2019 09:40 AM
I install desktoppr on all of my managed Macs and then set a simple script to run at login calling desktoppr and setting the wallpaper:
/usr/local/bin/desktoppr "/Library/Desktop Pictures/HCBOEwp.jpg"