question

Angelo333-9988 avatar image
0 Votes"
Angelo333-9988 asked wars commented

How can i remove restrictions to allow user to change background image

Hi,

I've created a Powershell script to set a company background image via Intune and deployed it to all users, we've decided later that we actually want users to change it if they want but I'm unable to find how exactly to do that and now is showing that some of these settings are hidden or managed by your organization.

I would appreciate it if someone knows how to reverse the changes and free the background again.

This is the script.


$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"


$DesktopPath = "DesktopImagePath"
$DesktopStatus = "DesktopImageStatus"
$DesktopUrl = "DesktopImageUrl"

$StatusValue = "1"


$url = "https://www.thelazyadministrator.com/wp-content/uploads/2019/07/nicewall.jpg"
$DesktopImageValue = "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, $DesktopImageValue)



if (!(Test-Path $RegKeyPath))
{
Write-Host "Creating registry path $($RegKeyPath)."
New-Item -Path $RegKeyPath -Force | Out-Null
}


New-ItemProperty -Path $RegKeyPath -Name $DesktopStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $DesktopPath -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $DesktopUrl -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null

RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters 1, True


mem-intune-general
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Angelo333-9988, How are things going? Did you try the suggestions from RahulJindal? Was it working? If there's any update, feel free to post back.

0 Votes 0 ·

Hey,

You can simply delete the following registry key which will allow the user to change the desktop wallpaper if required. Deleting the key does not remove the currently set wallpaper image.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP\DesktopImagePath

I have scripted this on Intune and created a group for users who wish to change their wallpaper for visual aid purposes. This script must be run after the initial one to set the image, otherwise it won't set at all.

$path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
$PCSP = Get-ItemProperty $path -Name "DesktopImagePath" -ErrorAction SilentlyContinue
if (!$null -eq $PCSP) {Remove-ItemProperty -Path $path -Name "DesktopImagePath" -Force}
if ($false -eq (Test-Path "$env:ProgramData\Microsoft\AllowBackgroundPersonalization")) {$scriptfile = New-Item -ItemType Directory -Path "$env:ProgramData\Microsoft\AllowBackgroundPersonalization"}

0 Votes 0 ·

1 Answer

RahulJindal-2267 avatar image
0 Votes"
RahulJindal-2267 answered

Hi, have you tried removing the assignment of the PS and then deploying a policy for desktop wallpaper as disabled using settings catalog? In theory it will come down as a managed setting and since the value is disabled, user should be able to set the wallpaper themselves.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.