Posted September 10, 20213 yr I have a wallpaper here: "https://e11onze-public.s3.eu-west-3.amazonaws.com/Assets/Wallpaper_3840x2160.png" I want to standardise this across all my workstations Please help
September 10, 20213 yr 11 hours ago, Darren Smith said: I have a wallpaper here: "https://e11onze-public.s3.eu-west-3.amazonaws.com/Assets/Wallpaper_3840x2160.png" I want to standardise this across all my workstations Please help I'm guessing you don't have a domain setup in this environment? If you do, by all means, please utilize a GPO, it's much easier and is the recommended way for something like this. Or even set a login script. However, if these are not options for you, I've written the below you can use. I've tested it a little and it does the trick for all user accounts on a workstation (aside from Public, Administrator, Default). Please note, I don't know anything about your environment or how you envision this going. I assume you want to deploy it via Pulseway. This will force log off any users that are currently logged in, in order to mount their registry hive and set the needed key. Function New-FileDownload { param( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$Url, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$Destination ) $webClient = New-Object System.Net.WebClient $webClient.DownloadFile($Url, $Destination) if (Test-Path -LiteralPath $Destination) { Write-Verbose "File downloaded Successfully" return $true } else { Write-Verbose "File download Failed" return $false } } $ImageURL = "https://e11onze-public.s3.eu-west-3.amazonaws.com/Assets/Wallpaper_3840x2160.png" $Destination = "$($env:systemdrive)\Users\Public\Pictures\wallpaper.png" $ImageDownload = New-FileDownload -Url $ImageURL -Destination $Destination if ($ImageDownload) { Write-Output "Image downloaded. Continuing..." } else { Write-Output "Failed to download. Exiting." Exit 1 } $Users = (Get-ChildItem "$($env:systemdrive)\users").Name foreach ($User in $Users) { if ($User -eq $env:username) { Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Control Panel\Desktop" -Name "Wallpaper" -value "$Destination" } if ($User -eq "Public" -or $User -eq "Administrator" -or $User -eq "Default") { Write-Output "Skipping $User" } else { $Sessions = Query Session $SessionID = $Sessions | Where-Object { $_ -match "$($User)" } if ($SessionID) { $ID = $SessionID.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries) LogOff $ID[2] Start-Sleep -Seconds 20 } $LoadHive = REG LOAD HKU\temp "$($env:systemdrive)\Users\$user\ntuser.dat" if ($LoadHive -match "successfully") { Set-ItemProperty -Path "Registry::HKEY_USERS\Temp\Control Panel\Desktop" -Name "Wallpaper" -value "$Destination" Write-Output "Image set for $User." [GC]::Collect() [GC]::WaitForPendingFinalizers() $UnloadHive = REG UNLOAD HKU\temp if ($UnloadHive -match "successfully") { Write-Output "Hive unloaded successfully." } else { Write-Output "Failed to unload hive. Exiting." Exit 1 } } else { Write-Output "Failed to load Hive for $User" } } } RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters , 1 , True
September 12, 20213 yr Author You are a wonderful human being. Many thanks for this. i will try it out and let you know.
January 22, 20241 yr Apologies for bumping the thread but will this require the client to be running an Enterprise version of Windows? I've been finding since going through a lot of Intune setup that without using group policy setting a desktop wallpaper and lock-screen wallpaper is a lot more difficult than it really should be! 😅 EDIT: I haven't tried the script but on second thought it's not using the PersonalizationCSP key in the registry so maybe this will be okay without an Enterprise SKU. Edited January 22, 20241 yr by Marc Lye
Create an account or sign in to comment