Another way to change and deploy Desktop background

Karl941
New Contributor III

Hi Community,

I am just sharing here another way of deploying silently a new Desktop Background to Mac computers without using Script install, Desktoppr or a Configuration Profile. This workflow is compatible from Catalina to Monterey Beta.

  1. Place your_image.png into /Users/Shared
  2. Open Automator app on macOS Big Sur
  3. Create New application project
  4. Choose in Library 'Get Specified Finder Items" and select your_image.png (located in /Users/Shared)
  5. Add "Set Desktop Picture" in Automator library
  6. Export your Automator project > Save (ideally sign it) into /Users/Shared
  7. Open Composer app
  8. Drag and Drop your Automator.app in it (from /Users/Shared)
  9. Add from Users/Shared folder in Composer your_image.png
  10. Select Script and Post-Install
  11. Copy paste this simple script below
  12. Build and sign your package
  13. Create your Jamf Policy to deploy it

 

 

#!/bin/bash
open /Users/Shared/Your_Automator.app
sleep 10
rm -R /Users/Shared/Your_Automator.app
rm -rf /Users/Shared/Your_Image.png

 

 

Hope it may be useful!

25 REPLIES 25

smcshaner
New Contributor III

Great Work Flow Thanks! 😀

J_Mukite
New Contributor III

Thank you for sharing this. 

jseckler-adi
New Contributor II

This is great! Instead of doing 1 image, I did an entire folder, full of images I wanted to cycle through. This actually works as well. 

 

Wanted to make a quick edit to describe my final results.

I made a folder here /Library/Desktop Pictures/My Images, then created sub folders, /Library/Desktop Pictures/My Images/Image1, etc. I created an automator app as well as placed my image source file into image 1. I repeated this process for each desktop that I wanted to have.

 

For instance, I have Image1-12, each with a desktop background with its own automator app. Placed the entire folder "My Images" into composer, and gave them all 757 permissions.

Uploaded the package to jamf, create a "source" policy that drops the images and apps onto the users mac into that location, then made 12 separate policies for each background then assigned to a category in jamf called "Desktop Wallpaper". 

The polices are just files and processes: open "/Library/Desktop Pictures/My Images/Image1/Image1.app" under execute command. Set to an ongoing policy, available in Self Service, under its own category Desktop Wallpaper. I uploaded icons for each policy, so the user gets a preview of what the desktop will look like, before even setting it. Renamed the run actions to "Set" and "Reset" when running the policy in Self Service. 

Karl941
New Contributor III

@jseckler-adi Thanks for sharing, it's also  a clever way to add value for users to choose specific images as background desktop (or other usage) through simple policy call. 

janzaldua
Contributor

Hello this works great, but I have a slight problem. If I have my MacBook connected to a docking station with multiple monitors (which many users do), the background only gets deployed to a single monitor (not both).

And a follow question. Will this still work if the Main drive is named something other than 'Macintosh HD'? Such as 'untitled' or 'Mac HD'? 

Thanks.

Karl941
New Contributor III

Hi Janzaldua

I unfortunately haven't found a way to deploy it to both. In my environment, the wallpapers are available through the self service and to target the proper display, the SS app must be placed on the targeted screen you want to apply the image.

The script commands are targeting the user environment so it does not matter the name of the local HD drive.

Thanks for the reply Karl! This would have worked perfect if it was able to deploy to both/all available monitors/desktops. Another nice feature would be adding the photo to the wallpaper library, so it shows up as an option to click.

Karl941
New Contributor III

Try this @janzaldua 

#!/bin/bash
# Add Desktop Wallpapers to System Preferences

rm ~/Library/Preferences/com.apple.systempreferences.plist
killall -hup cfprefsd

sleep 3


defaults write /Library/Preferences/com.apple.systempreferences DSKDesktopPrefPane '<dict><key>UserFolderPaths</key><array><string>YOUR_PATH_TO_FOLDER_IMAGE_HERE</string></array></dict>'

defaults write ~/Library/Preferences/com.apple.systempreferences DSKDesktopPrefPane '<dict><key>UserFolderPaths</key><array><string>YOUR_PATH_TO_FOLDER_IMAGE_HERE</string></array></dict>'

killall -hup cfprefsd

jkingqc
New Contributor II

I am trying this exact process but it appears to not work with Sonoma at all. I received an error that it is not compatible with this version of macos. Any guidance on this would be great. I'm tasked with pushing out an updated wallpaper to all our macs. 

Karl941
New Contributor III

I can't really tell you as I am using the same process and it works great with Sonoma. Is your Process run well on Ventura for instance? Any additional log or errors to build on?

jkingqc
New Contributor II

I have to do a little bit more research. The issue is somewhere after creating the pkg. If I run the app, it runs fine and sets the wallpaper correctly. It's after the package gets created that this failure happens. I'm working on it now. Fingers crossed. 

jkingqc
New Contributor II

Figured it out. it was down to how i was adding the /shared folder in composer. Thanks for this post. 

 

Avillar
New Contributor II

Can you make a small video clip on how to do this? Still a little confused.

Karl941
New Contributor III

I unfortunately won't have the time to record the whole process. However, can I help you find out what's  confuses you? 

wdubin
New Contributor

This seems overly complicated to me. A package that adds the image to the \users\shared folder and a single line of code is working great for us(thanks chatGPT).  Set the policy to run once per user per computer and there you go!  Here is the sample code:

osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Users/Shared/your_wallpaper.jpg"'

Pomeroy21
New Contributor II

Hi everyone! 

Do I need an apple developer account to be able to sign the package? 

Pomeroy21
New Contributor II

clarification - I want to automatically install the background image without user interaction. 

Karl941
New Contributor III

Hello Pomeroy21

Hi Pomeroy21
You can use Jamf built-in CA to sign your package if you do not have a Dev Apple account. 

https://learn.jamf.com/en-US/bundle/technical-articles/page/Creating_a_Signing_Certificate_Using_Jam...

Pomeroy21
New Contributor II

Hi Karl941!
I've been struggling all morning to get it to work using the guide. I've tried deploying policies and profiles. I still can't get it to work and the test computer keeps asking for permission to install the background. Certificate downloaded from jamf, uploaded to keychain. Still can't get it to work... 

 

Pomeroy21
New Contributor II

I managed to get it fixed today! Not sure what I did wrong but it works! Thanks! 

prabhakf
New Contributor

Stumbled upon this today when trying to find a way to set background on enrollment but allow users to change it when they want to.

Thank you for this!

Keith__Myers
New Contributor III

Worked perfectly on macOS 14.5! 

--- Keith Myers

Karl941
New Contributor III

I am glad to still see this alternative working :)  

IrvinAlo
New Contributor

@Karl941 

Thanks for the steps here!  I have the automator app working and have a JAMF Policy ready for set up but,

I am fairly new to Composer. I installed it on my machine and running it through Terminal as the documentation and guides show but your steps makes it seem there is a GUI for it that i am not seeing.

Am i missing a step or do i need to read up on the composer commands to get through the rest of steps 7-12 

Any help is appreciated ! 

Karl941
New Contributor III

Hi IrvinAlo,

Since you can add your Automator.app and a post script inside your PKG, you are fine to use any of your favorite packager app.

It might be worth to check Composer documentation as I am not familiar about the CLI you used to run it.