In my previous article I showed you how you can leverage PowerShell and Intune to set a computers wallpaper even if the OS was not Enterprise or Education. Currently, If you want to set the wallpaper or lock screen wallpaper via Intune Policies, you must be on either Enterprise or Education. In this article I will show you how you can leverage PowerShell and Intune, and set your own lock screen wallpaper no matter the version.
In my example I will use Intune to set the lock screen image of my end user machines to the following image:
First, we need to create a PowerShell script that will do the following:
- Download the wallpaper
- Store the wallpaper locally on the target machine
- Set the lock screen wallpaper
In my example, I want to set my wallpaper as the following image: https://www.thelazyadministrator.com/wp-content/uploads/2019/07/nicewall.jpg, which will be named wallpaper_LazyAdmin.jpg and stored at C:\MDM. If the directory is not present it will create it, and if the proper registry keys are not found it will create them as well.
$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
$LockScreenPath = "LockScreenImagePath"
$LockScreenStatus = "LockScreenImageStatus"
$LockScreenUrl = "LockScreenImageUrl"
$StatusValue = "1"
$url = "https://www.thelazyadministrator.com/wp-content/uploads/2019/07/nicewall.jpg"
$LockScreenImageValue = "C:\MDM\wallpaper_LazyAdmin.jpg"
$directory = "C:\MDM\"
If ((Test-Path -Path $directory) -eq $false)
New-Item -Path $directory -ItemType directory
$wc = New-Object System.Net.WebClient
if (!(Test-Path $RegKeyPath))
Write-Host "Creating registry path $($RegKeyPath)."
New-Item -Path $RegKeyPath -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $LockScreenStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $LockScreenPath -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $LockScreenUrl -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters 1, True
TIP: Because we are modifying the PersonalizationCSP key, users will see that the lock screen image is managed by Group Policy
In the Azure Portal, navigate to Intune > Device Configuration > PowerShell scripts and press “+ Add” to add a new PowerShell configuration script
In the Script Settings section, specify the PowerShell script file we created and saved up above
In the Assignments section, I will assign this policy to my “Intune Devices” group. You can apply this to any group you prefer. Once you have assigned the policy to the correct group(s) press Next
Finally, in the Review + Add section, review your new configuration policy. If it is set up to your enterprises needs, press Add.
On my target machine I can see that the policy applied as my lock screen wallpaper is the image specified
My name is Bradley Wyatt; I am currently a Technology Specialist at Porcaro Stolarek Mete Partners which is headquartered in Chicago, Illinois. At PSM we provide solutions which are custom designed around the specific needs of each client. If you are looking for a career change or would like to learn more about PSM’s offerings, please feel free to e-mail me.