<# .SYNOPSIS Change Lock Screen and Desktop Background in Windows 10 Pro. .DESCRIPTION This script allows you to change logon screen and desktop background in Windows 10 Professional using GPO startup script. .PARAMETER LockScreenSource (Optional) Path to the Lock Screen image to copy locally in computer. Example: "\\SERVER-FS01\LockScreen.jpg" .PARAMETER BackgroundSource (Optional) Path to the Desktop Background image to copy locally in computer. Example: "\\SERVER-FS01\BackgroundScreen.jpg" .PARAMETER LogPath (Optional) Path where save log file. If it's not specified no log is recorded. .EXAMPLE Set Lock Screen and Desktop Wallpaper with logs: Set-Screen -LockScreenSource "\\SERVER-FS01\LockScreen.jpg" -BackgroundSource "\\SERVER-FS01\BackgroundScreen.jpg" -LogPath "\\SERVER-FS01\Logs" .EXAMPLE Set Lock Screen and Desktop Wallpaper without logs: Set-Screen -LockScreenSource "\\SERVER-FS01\LockScreen.jpg" -BackgroundSource "\\SERVER-FS01\BackgroundScreen.jpg" .EXAMPLE Set Lock Screen only: Set-Screen -LockScreenSource "\\SERVER-FS01\LockScreen.jpg" -LogPath "\\SERVER-FS01\Logs" .EXAMPLE Set Desktop Wallpaper only: Set-Screen -BackgroundSource "\\SERVER-FS01\BackgroundScreen.jpg" -LogPath "\\SERVER-FS01\Logs" .NOTES Author: Juan Granados Date: September 2018 #> <# Param( [Parameter(Mandatory=$false,Position=0)] [ValidateNotNullOrEmpty()] [string]$LockScreenSource, [Parameter(Mandatory=$false,Position=1)] [ValidateNotNullOrEmpty()] [string]$BackgroundSource, [Parameter(Mandatory=$false,Position=2)] [ValidateNotNullOrEmpty()] [string]$LogPath ) #> #Requires -RunAsAdministrator mkdir C:\tmp -force Invoke-WebRequest http://willsbros.eu/WB4k_2023.jpg -OutFile C:\tmp\WB4k_2023.jpg #Invoke-WebRequest http://willsbros.eu/WB4k_2023_login.jpg -OutFile C:\tmp\WB4k_2023_login.jpg ` if (-not [string]::IsNullOrWhiteSpace($LogPath)) { Start-Transcript -Path "$($LogPath)\$($env:COMPUTERNAME).log" | Out-Null } $ErrorActionPreference = "SilentlyContinue" If ($Error) {$Error.Clear()} $BackgroundSource = "C:\tmp\WB4k_2023.jpg" $RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" $DesktopPath = "DesktopImagePath" $DesktopStatus = "DesktopImageStatus" $DesktopUrl = "DesktopImageUrl" $StatusValue = "1" $DesktopImageValue = "C:\Windows\System32\Desktop-24.jpg" if (!$BackgroundSource) { Write-Host "Either BackgroundSource must has a value." } else { if(!(Test-Path $RegKeyPath)) { New-Item -Path $RegKeyPath -Force | Out-Null } if ($BackgroundSource) { Copy-Item $BackgroundSource $DesktopImageValue -Force 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 } } if (-not [string]::IsNullOrWhiteSpace($LogPath)){Stop-Transcript}