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 $wc.DownloadFile($url, $LockScreenImageValue) 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 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 $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 $wc . DownloadFile ( $url , $LockScreenImageValue ) 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

When you modify the PowerShell script to fit your corporate needs, save it locally as we will need to import it into Intune.

In the Azure Portal, navigate to Intune > Device Configuration > PowerShell scripts and press “+ Add” to add a new PowerShell configuration script

In the Basics section, give your policy a valid Name and Description and then press Next

In the Script Settings section, specify the PowerShell script file we created and saved up above

In the Scope Tags section, configure any scope tags for the policy. I do not have any scope tags so I will press Next

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 a Microsoft Most Valuable Professional and I am currently a Manager DevOps Cloud Automation at BDO Digital in the Chicagoland area.

Share this: Twitter

Facebook

LinkedIn

Reddit

Email

