Dieses Script entfernt den “Cave”-Hintergrund des Windows-Sperrbildschirms mit einer Plain-Farbe nach Wahl.
Funktionsweise: Das Script erstellt eine neue Bitmap (Format 1×1 px) und färbt dieses mit der angegebene HEX-Farbe. Dieses Bild wird in der Local GPO als Lockscreen-Hintergrund gesetzt.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
function Disable-LockScreenImage { <# .SYNOPSIS Replaces the default lockscreen image | marcozimmermann.com, 2018-11 .DESCRIPTION Replaces the default lockscreen image with a solid color of choice. If no color is specified black will be used. .PARAMETER Color Color-Code (hex .EXAMPLE Disable-LockScreenImage -Color ff0000 #> param ( [parameter(Mandatory=$false)] [ValidateNotNullOrEmpty()][string]$color = "000000" ) Add-Type -AssemblyName System.Drawing $img = "C:\Windows\Web\logon.png" $key = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization" # CONVERT COLORS FROM HEX TO RGB $alpha = [convert]::ToInt32("255") $red = [convert]::ToInt32($color.Remove(2,4),16) $green = [convert]::ToInt32(($color.Remove(4,2)).Remove(0,2),16) $blue = [convert]::ToInt32($color.Remove(0,4),16) [System.Drawing.Color]$color = [System.Drawing.Color]::FromArgb(255,$red,$green,$blue) # DRAW BITMAP $bmp = new-object System.Drawing.Bitmap 1,1 $bmp.SetPixel(0, 0, $color) $bmp.Save($img) # CHANGE POLICY If (!(Test-Path $key)) { New-Item -Path $key -ItemType Directory -Force | Out-Null } New-ItemProperty -Path $key -Name LockScreenOverlaysDisabled -Value 1 -PropertyType DWORD -ErrorAction SilentlyContinue New-ItemProperty -Path $key -Name LockScreenImage -Value $img -PropertyType String -ErrorAction SilentlyContinue } Disable-LockScreenImage -color ffffff |