In this post, I will show you how to set MacOS desktop wallpaper using Intune. With the help of a desktop wallpaper script and a mobileconfig file, you can perform macOS desktop wallpaper deployment with Intune.
For Windows devices, most organizations prefer to use group policy to deploy desktop background wallpaper. It works well on Windows 10 and Windows 11 devices. For Intune managed macOS devices, you have to use a combination of shell script and a custom configuration profile to set desktop wallpaper.
One of the members of the Intune Telegram group asked for a tutorial on how to set desktop wallpaper for macOS using Intune. Despite the fact that it appeared difficult, I wanted to test it in my lab and confirm that it worked. Now that my testing is complete, I was able to set desktop wallpaper for macOS devices using Intune, and I’ll walk you through the process.
Download the Scripts for Desktop Wallpaper and Wallpaper MobileConfig
Microsoft provides two files on their GitHub Shell Intune Samples for macOS desktop wallpaper deployment via Intune:
- downloadWallpaper.sh: This script is intended to be delivered to the Mac by the Intune Scripting Agent. This shell script downloads the wallpaper image from a URL specified and puts it in the /Library/Desktop location on the macOS device. The file name is set to Wallpaper.jpg.
- wallpaper.mobileconfig: A mobileconfig profile file instructs the Mac to actually change the wallpaper image.
To set macOS desktop wallpaper with Intune, you’ll need both of the above files. You will also need a web server to publish your Desktop Wallpaper image. If you have Azure Blob Storage, it is ideal for this; otherwise, any public web-server will suffice. I have downloaded both the files and saved it to a folder on my PC.
If you have the corporate desktop wallpaper image for macOS device, you will need to publicly host it. The image file URL should be accessible by anyone, and you should update this image path in the downloadwallaper.sh shell script file. Let me show you how to do that. Open the downloadwallpaper.sh file with Notepad application. Look for the “wallpaperurl” parameter and replace the image path with your corporate desktop wallpaper image and save the file.
Set MacOS Desktop Wallpaper using Intune
We will now go through the steps to set MacOS desktop wallpaper using Intune. I’ll break down the entire process into steps to make it easier to follow.
- Add a macOS Shell Script to download wallpaper
- Create a Custom Configuration profile to instruct mac to apply the wallpaper
In the end, I will also show you how to monitor the shell script and configuration profile assignments and cover about troubleshooting macOS desktop wallpaper deployment using logs.
Step 1: Add a macOS Shell Script in Intune to Download Wallpaper
In this step, we’ll add a new shell script in Intune to download wallpaper on macOS devices. If you’re new to mac scripts, refer to the following guide on how to use shell scripts on macOS using Intune.
- Sign in to Microsoft Intune admin center.
- Go to Devices > macOS > Shell Scripts.
- To add a new script, select +Add.
On the Basics tab, enter the name for the script as “Set Desktop Wallpaper for macOS using Intune“. Enter a brief description describing about the script and click Next.
On the Script Settings tab, click on the folder icon to upload the script to download wallpaper for macOS. Configure the following script settings in the same window.
- Run script as a signed-in user : No
- Hide script notifications on devices : Yes
- Script frequency : Every 1 day
- Number of times to retry if script fails : 3
You’ll see a notification “Upload completed for downloadwallaper.sh” confirming that the script has been uploaded successfully. You’ll also be able to review the script content, but it cannot be modified. Click Next.
On the Assignments tab, you select the Azure groups to assign the shell script. Select one or more user or device groups to whom you want to assign the script. The groups you select are shown in the list, and will receive your script policy. Click Next.
In Review + add, a summary is shown of the settings you configured. Select Add to save the script. When you select Add, the script policy is deployed to the macOS device/user groups you chose.
The desktop wallpaper macOS Shell script you created now appears in the list of scripts. If needed, you can select and view the contents of macOS shell scripts after you upload them to Intune.
Step 2: Create Configuration Profile to Set Desktop Wallpaper for macOS
In the Step 1, the script that we added will download the desktop wallpaper image to your MacOS devices. To apply the image as desktop wallpaper on macOS, we will create a new configuration profile.
- Sign in to Microsoft Intune admin center.
- Go to Devices > macOS > Configuration Profiles.
- Select Create Profile to add a new profile for macOS devices.
On the Create a Profile window, select the following:
- Profile Type: Templates
- Template Name: Custom
Enter the name for the Configuration Profile as “MacOS Desktop Wallpaper Deployment” or something relevant. You may add a brief description about the profile. Click Next.
On the Configuration Settings tab, specify the following information:
- Custom Configuration Profile Name: MacOS Desktop Wallpaper.
- Deployment Channel: Device Channel.
- Configuration Profile File: Click the folder icon and select the wallpaper.mobileconfig file to upload.
Wait until the wallpaper.mobileconfig file is successfully uploaded to Intune. Once it’s done, click Next.
On the Assignments tab, you select the Azure groups to apply the configuration profile. Select one or more user or device groups to whom you want to assign the profile. The groups you select are shown in the list, and will receive your profile settings. Click Next.
In Review + add, a summary is shown of the settings you configured. Select Create to create the configuration profile. When you select Create, the profile settings are deployed to the macOS device/user groups you chose.
Monitor MacOS Desktop Wallpaper Deployment in Intune
As we have assigned a macOS Shell script and a custom configuration profile to set desktop wallpaper for macOS, both of these can be monitored in the Intune Portal.
You can monitor the run status of all assigned macOS scripts for users and devices by choosing one of the following reports in Intune:
- Shell Scripts > select the script to monitor > Device status.
- Shell Scripts > select the script to monitor > User status.
From the screenshot below, we see the macOS script to download the wallpaper has succeeded on the devices.
To monitor the custom configuration profile for macOS, go to Devices > macOS > Configuration Profiles. From the list of profiles, select the MacOS desktop wallpaper profile and review the status. From the screenshot below, we see the macOS devices that have successfully received the profile settings.
Note: In case you find any errors here, make sure the macOS devices are online. Make a note of the error code that will help you troubleshoot the issue.
Verify Desktop Wallpaper on macOS Devices
In this step, we will check to see if the desktop wallpaper image was successfully changed on our macOS device. After a few minutes, I saw the desktop wallpaper image was successfully applied to the Mac device. Note that I had to restart my MacBook once as there was an issue with company portal in synchronizing the policies.
Troubleshooting the Intune MacOS Wallpaper Deployment
It is possible that the desktop wallpaper will not be applied to all of your Mac devices. This will necessitate troubleshooting, and you will need to rely on log files. The Intune management agent logs on macOS are located in the /Library/Logs/Microsoft/Intune. The agent log file-names are IntuneMDMDaemon date–time.log and IntuneMDMAgent date–time.log.
When you don’t see the desktop wallpaper applied to your macOS device, the first step that you need to do is check whether the wallpaper image is downloaded to your Mac or not. Remember that the downloadwallaper.sh downloads the image from the specified URL and places it in /Library/Desktop. On your Mac, go to /Library/Desktop and verify if you see the wallpaper image. If you see this file, proceed to the next troubleshooting step.
If the wallpaper is already copied to your macOS, the next step is to ensure the wallpaper has been applied. The mobileconfig profile file instructs the Mac to actually change the wallpaper image. This process is logged in a separate file and outputs to /var/log/fetchdesktopwallpaper.log by default. Open the fetchdesktopwallpaper.log with a text editor app and review the log. Exit status is either 0 or 1.
Starting download of Desktop Wallpaper
Downloading Wallpaper from [https://github.com/microsoft/shell-intune-samples/raw/master/img/M365.jpg] to [/Library/Desktop/Wallpaper.jpg]
Wallpaper [https://github.com/microsoft/shell-intune-samples/raw/master/img/M365.jpg] downloaded to [/Library/Desktop/Wallpaper.jpg]