# PowerShell script to set the SAME image as Desktop Wallpaper + Lock Screen for ALL users # Run as Administrator $ProgressPreference = 'SilentlyContinue' $imageUrl = "https://download.greenbeanit.com/bgas/lockscreen.png" $wallpaperDir = "C:\Windows\Web\Wallpaper\Custom" $imagePath = Join-Path $wallpaperDir "lockscreen.png" # Create directory if (-not (Test-Path $wallpaperDir)) { New-Item -Path $wallpaperDir -ItemType Directory -Force | Out-Null } # Download the image Write-Host "Downloading image..." try { Invoke-WebRequest -Uri $imageUrl -OutFile $imagePath -UseBasicParsing Write-Host "Image downloaded to: $imagePath" } catch { Write-Host "Download failed: $_" -ForegroundColor Red exit 1 } # ======================== # 1. Set for ALL EXISTING USERS + DEFAULT (new users) # ======================== # Function to set wallpaper keys function Set-WallpaperRegistry { param([string]$RegPath) Set-ItemProperty -Path $RegPath -Name "Wallpaper" -Value $imagePath -Force -ErrorAction SilentlyContinue Set-ItemProperty -Path $RegPath -Name "WallpaperStyle" -Value "10" -Force -ErrorAction SilentlyContinue # 10 = Fill Set-ItemProperty -Path $RegPath -Name "TileWallpaper" -Value "0" -Force -ErrorAction SilentlyContinue } # Set for .DEFAULT (new user profiles) $defaultPath = "Registry::HKEY_USERS\.DEFAULT\Control Panel\Desktop" if (Test-Path $defaultPath) { Set-WallpaperRegistry -RegPath $defaultPath Write-Host "Default profile (new users) updated." } # Set for currently logged-in user $currentUserPath = "HKCU:\Control Panel\Desktop" Set-WallpaperRegistry -RegPath $currentUserPath # Set for all other user profiles (load their NTUSER.DAT) $usersDir = "C:\Users" Get-ChildItem $usersDir -Directory | Where-Object { $_.Name -notin @("Public", "Default", "All Users", "Default User") } | ForEach-Object { $ntuserPath = Join-Path $_.FullName "NTUSER.DAT" $tempHive = "HKU\TempUser_$($_.Name)" if (Test-Path $ntuserPath) { try { reg load $tempHive $ntuserPath | Out-Null $userDesktopPath = "Registry::$tempHive\Control Panel\Desktop" Set-WallpaperRegistry -RegPath $userDesktopPath Write-Host "Updated profile: $($_.Name)" } catch { Write-Host "Skipped $($_.Name) (in use or error)" -ForegroundColor Yellow } finally { reg unload $tempHive 2>$null | Out-Null } } } # ======================== # 2. Enforce via PersonalizationCSP (System-wide, same as lockscreen) # ======================== $cspPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" if (-not (Test-Path $cspPath)) { New-Item -Path $cspPath -Force | Out-Null } # Lock Screen (already had this) Set-ItemProperty -Path $cspPath -Name "LockScreenImagePath" -Value $imagePath -Force Set-ItemProperty -Path $cspPath -Name "LockScreenImageStatus" -Value 1 -Force Set-ItemProperty -Path $cspPath -Name "LockScreenImageUrl" -Value $imagePath -Force Write-Host "`n✅ Successfully applied background and lockscreen for all users!" -ForegroundColor Green Write-Host "You may need to log off / log on (or restart) for changes to fully take effect on other accounts."