Custom LockScreen image in Windows 10 with PowerShell

If you want the possibility to use a static background on your Windows 10 clients for the lock screen, be it at work or at home, you can use something called PersonalizationCSP that came with Windows 10 1703.

With this option you can set a static picture as the image background for everyone at the lock screen.

If you use this, keep in mind that users that are local administrators still can change this through other ways and if you do not set the permissions correct on the folder where the picture resides, they can swap it out easily.

The script assumes you have placed the picture under C:\OemFiles and called it LockScreen.jpg.

This script do not take into account different screen resolutions, nor the placement, like Tile, Center, Stretch and so on, some of these settings are per user and i think it gets the Fill option as standard, just something to think about when deciding what picture to use.

After the script has been used, you might need to restart the computer to see the change, can work with a simple log out at most times.

This script should work for Home and Work clients that have at least Windows 10 Pro or Enterprise versions.

# The Script sets custom background Images for the Lock Screen by leveraging the new feature of PersonalizationCSP
# that is only available in the Windows 10 v1703 aka Creators Update and later build versions
# Applicable only for Windows 10 v1703 and later build versions
# Script also assumes that you have already copied over the LockScreen Image to the C:\OEMFiles\ folder and are named as LockScreen.jpg
# Remember to set permissions on the folder the way you want it, if you do not want users to change file in the folder give them only read on the folder and files.

# CSP registry path
$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"

# CSP Registry key names
$LockScreenImagePath = "LockScreenImagePath"
$LockScreenImageStatus = "LockScreenImageStatus"

# CSP Status
$StatusValue = "1"

# Image to use
$LockScreenImageValue = "C:\OEMFiles\LockScreen.jpg"  # Change as per your needs

## Check if PersonalizationCSP registry exist and if not create it and add values, or just create the values under it.
if(!(Test-Path $RegKeyPath)){
    New-Item -Path $RegKeyPath -Force | Out-Null
    # Allows for administrators to query the status of the lock screen image.
    New-ItemProperty -Path $RegKeyPath -Name $LockScreenImageStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
    # Set the image to use as lock screen background.
    New-ItemProperty -Path $RegKeyPath -Name $LockScreenImagePath -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
}

else {
    # Allows for administrators to query the status of the lock screen image.
    New-ItemProperty -Path $RegKeyPath -Name $LockScreenImageStatus -Value $value -PropertyType DWORD -Force | Out-Null
    # Set the image to use as lock screen background.
    New-ItemProperty -Path $RegKeyPath -Name $LockScreenImagePath -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
}

Leave a Reply

Your email address will not be published. Required fields are marked *