Darren Smith Posted September 10, 2021 Posted September 10, 2021 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
Mark G38 Posted September 10, 2021 Posted September 10, 2021 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 Jamie Taylor 1
Darren Smith Posted September 12, 2021 Author Posted September 12, 2021 You are a wonderful human being. Many thanks for this. i will try it out and let you know. Mark G38 1
Jamie Taylor Posted September 13, 2021 Posted September 13, 2021 Thanks for helping our users Mark, appreciate it. Mark G38 1
Jay P Posted February 3, 2023 Posted February 3, 2023 Is there a way to do this with the Windows login screen as well?
Marc Lye Posted January 22 Posted January 22 (edited) 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 by Marc Lye
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now