0

Hi I am very new using powershell, I am trying to deploy a desktop wallpaper, which I can but, I would like to know if there's a way where the user can change it, because so far it is not possible. Do I need to modify something on the script or perhaps create a new one? thanks in advance!

Edit: I completely forgot to mention that I deployed it via intune scripts, so this run to our users and deploy the wallpaper and we want they still can change it, it is not mandatory for them to have the company's wallpaper.

This is the script I used:   

$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
$DesktopPath = "DesktopImagePath"
$DesktopStatus = "DesktopImageStatus"
$DesktopUrl = "DesktopImageUrl"
$StatusValue = "1"
$url = "https://example.png"
$DesktopImageValue = "C:\MDM\example.png"
$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
Ryu
  • 1
  • 2
  • It's unclear which part is "not possible", please tell us more about what happens when the user attempts to use the script – Mathias R. Jessen Jul 11 '23 at 17:05
  • Yes hi, sorry I was rushing while trying to put the question altogether, I deploy this script via intune so our users can have their wallpaper change, but we still want them to change it if they wish, but with this script they cannot do so, thanks, hopefully this clarify it! – Ryu Jul 11 '23 at 17:13
  • And what are you imagining for the user interaction? Do you want them to be able to drop a png file in a specific folder on their local machine? – Mathias R. Jessen Jul 11 '23 at 17:29
  • So far they were using any picture/image they want or have in their machines. This was a marketing request to set a company image to their computers but with the ability of changing wallpaper in the event they don't like it or want it, dunno if this makes sense. – Ryu Jul 11 '23 at 17:43
  • The value of $StatusValue is set to "0", which allows users to change the wallpaper. When you want to enforce a specific wallpaper, you can change the value back to "1" to prevent users from modifying it. – Venkat V Jul 13 '23 at 05:04

0 Answers0