Skip to content

Static Desktop Background Windows 10 With PowerShell

If you want the possibility to use a static background on your Windows 10 clients, 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 that logs into the computer and it disables the options to change it via Personalize in settings.

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 Desktop.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 must log out and then in again to see the changes.

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 Desktop 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 Desktop Image to the C:\OEMFiles\ folder and are named as Desktop.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.
# More info here: https://docs.microsoft.com/sv-se/windows/client-management/mdm/personalization-csp
## CSP registry path
$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
## CSP Registry key names
$DesktopImagePath = "DesktopImagePath"
$DesktopImageStatus = "DesktopImageStatus"
## CSP Status(We set it to 1), see more about status values in link above.
$StatusValue = "1"
## Image to use
$DesktopImageValue = "C:\OEMFiles\Desktop.jpg"
## Check if PersonalizationCSP registry exist and if not create it and add values, or just create the values under it.
if(!(Test-Path $RegKeyPath)){
    # Creates the PersonalizationCSP registry
    New-Item -Path $RegKeyPath -Force | Out-Null
    # Allows for administrators to query the status of the desktop image.
    New-ItemProperty -Path $RegKeyPath -Name $DesktopImageStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
    # Set the image to use as desktop background.
    New-ItemProperty -Path $RegKeyPath -Name $DesktopImagePath -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
}
else {
    # Allows for administrators to query the status of the desktop image.
    New-ItemProperty -Path $RegKeyPath -Name $DesktopImageStatus -Value $Statusvalue -PropertyType DWORD -Force | Out-Null
    # Set the image to use as desktop background.
    New-ItemProperty -Path $RegKeyPath -Name $DesktopImagePath -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
}