Set preference for a suitable wallpaper with Intune

If you deliver a concept of a modern managed Windows 10 desktop managed with Intune, you take care of security settings and necessary Windows configurations. One part of the important configurations, beside security settings, are the small corporate identity things like corporate logon screen or corporate wallpaper. I’m totally okay with the option in Intune to configure the logon screen to a fixed image, which can’t be modified by the end user.

Microsoft Intune locked screen configuration policy
Microsoft Intune Locked screen configuration policy

It is something which provides little effort to implement and does a really good job. For example when you have a class room and all devices are locked, you get a really nice uniform appearance.

Sadly for the desktop background (aka wallpaper) this is a bit more challenging. I really do like the idea to personally enable the modern desktops today. I’m not talking about BYOD, I’m still talking about a corporate device. But a modern approach for me, is a choose your own device (CYOD) policy and the ability to personalize the device in a certain degree to you personal needs. For this I really want users to let them define their own wallpaper. They should walk away with their new device and think, “Hey, I really love my newly chosen device and I’m able to make it personal”. This way people can be productive as their device fits their individual needs. It serves how they work and they feel esteemed by their company. In fact this is for some younger people a hiring reason. Many people sit in front of their devices 8h and more a day. So the Intune native configuration profile option to set a fixed wallpaper is not going to fit in my approach. I want people to make the desktop more personal.

Microsoft Intune Desktop background picture configuration policy
Microsoft Intune Desktop background picture configuration policy

I want to set a predefined wallpaper and let the user change it later on if he likes to. Trying to make him happy and let his family picture generate a smile on his face :-).

As Intune only has the option to set it fixed, I wrote a small script to do this job for me. There are a lot of other solutions out there covering this topic, this is now my approach. I wanted to have a similar approach like Intune, pointing to a public URL, I’ve chosen a Azure blob storage to store the wallpaper images. To provide the best user experience I implemented a small extra logic to find the aspect ratio of the primary monitor. For example, most laptops nowadays come with a ratio of 16×9 or 3×2. So, the script is figuring out the aspect ratio and downloads a wallpaper fitting this aspect ratio. By definition for a 16×9 aspect ratio it will download the file wallpaper-16×9.jpg from the Azure blob storage. This way I can provide the correct wallpapers for every device with little effort. I just have to create them and upload them to the Azure blob storage account. If you don’t like to provide so many different wallpapers, I do a fallback. If a wallpaper for the determined aspect ratio is not found, I try to get one which is mostly compatible. For example a 4×3 display is detected and the image is not available, I will do a fallback download to 3×2.

As the lowest common denominator you have to provide 2 wallpaper images on the Azure blob storage. In the fallback case all aspect ratios will be mapped to one of these ratios:

  • wallpaper-16×9.jpg
  • wallpaper-3×2.jpg

Here an example of a Azure blob storage container:

Azure blob storage container hosting wallpaper images
Azure blob storage container hosting wallpaper images

The access level must be set to anonymous read access (anonymous access is totally okay for wallpapers in my opinion, nothing to hide or containing relevant information, keep it simple):

Set Azure blob storage container to anonymous read access level
Set Azure blob storage container to anonymous read access level

So, if everything is setup for the wallpaper storage, you have to upload the PowerShell script to Intune. The script figures out the aspect ratio and gets the correct wallpaper image and sets it for you. The script must be configured to run in user context of the logged on user:

Intune PowerShell script Set-Wallpaper configured to run in user context
Intune PowerShell script Set-Wallpaper configured to run in user context

If you later decide to update the picture you can simply replace the images on the Azure blob storage with the new wallpaper images. Then you have to re-upload the PowerShell script to Intune to trigger it again. The re-upload is necessary, otherwise Intune will not trigger the script again, as it is marked as already run.

The following logic is available in the script:

  • On the first run on the script, if there is no wallpaper found, the script will download and set the correct wallpaper for the aspect ratio.
  • If the script is triggered to run again:
    • If the current wallpaper is still our pre-defined one (registry: HKCU\Control Panel\Desktop\WallPaper) the script will go and download the correct aspect ratio image again and set/refreshes it.
    • If the current wallpaper is a user-defined one, the script will not change anything.

This makes it possible to change the pre-defined wallpaper only for devices which are still having the pre-defined wallpaper set. All other devices which already set a personalized wallpapers are not touched.

Everything will be logged to “%localappdata%\temp\Set-Wallpaper.log” in the format of the ConfigMgr Tace Log Tool (cmtrace.exe), like seen below into

Set-Wallpaper script detecting aspect ratio
Set-Wallpaper script detecting aspect ratio

To get everything working just replace the Azure blob storage account with your blob container URL:

Set-Wallpaper script
Set-Wallpaper script

To setup an Azure blob storage account just follow this official guide here: Quickstart: Upload, download, and list blobs with the Azure portal

Update: Based on a readers comment, I would like to mention here that it is also possible to modify the wallpaper prefix, in the script example above $global:wallpaper is set to wallpaper. You can easily change this to your needs, same for the extension if you like to have .png files. Changing the prefix gives the option to target two versions of the script to different AAD groups. Example: Wallpaper script one for APAC has prefix set to apac, script two for EMEA set to emea. The blob storage can be the same(!), it just needs to have apac-16×9.jpg, apac-3×2.jpg and emea-16×9.jpg and emea-3×2.jpg. Now target APAC wallpaper script to APAC user group and EMEA wallpaper script to EMEA users group. Et voilà!

If everything went well you will see a nice fitting wallpaper applied to your device, right after enrollment wit Autopilot. In this example a 16×9 wallpaper was used from the blob storage container.

Custom wallpaper applied to Windows 10
Custom wallpaper applied to Windows 10

If you like to give it a try go and get it from my GitHub account here:

https://github.com/okieselbach/Intune/blob/master/Set-Wallpaper.ps1

So, my final words are, make your end users happy by allowing them a nice wallpaper and still provide some good looking corporate branding after enrollment of the device.