$ImageUrl = "https://wallpaper.fasco.dev/Nick.php" $WallpaperDir = "$env:LOCALAPPDATA\ManagedWallpaper" $WallpaperPath = "$WallpaperDir\wallpaper.jpg" New-Item -ItemType Directory -Path $WallpaperDir -Force | Out-Null Invoke-WebRequest -Uri $ImageUrl -OutFile $WallpaperPath $DesktopKey = "HKCU:\Control Panel\Desktop" Set-ItemProperty -Path $DesktopKey -Name Wallpaper -Value $WallpaperPath Set-ItemProperty -Path $DesktopKey -Name WallpaperStyle -Value "10" Set-ItemProperty -Path $DesktopKey -Name TileWallpaper -Value "0" $ActiveDesktopKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop" New-Item -Path $ActiveDesktopKey -Force | Out-Null New-ItemProperty ` -Path $ActiveDesktopKey ` -Name "NoChangingWallPaper" ` -PropertyType DWord ` -Value 1 ` -Force | Out-Null $SystemPolicyKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System" New-Item -Path $SystemPolicyKey -Force | Out-Null New-ItemProperty ` -Path $SystemPolicyKey ` -Name "Wallpaper" ` -PropertyType String ` -Value $WallpaperPath ` -Force | Out-Null New-ItemProperty ` -Path $SystemPolicyKey ` -Name "WallpaperStyle" ` -PropertyType String ` -Value "2" ` -Force | Out-Null Add-Type @" using System; using System.Runtime.InteropServices; public class Wallpaper { [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern int SystemParametersInfo( int uAction, int uParam, string lpvParam, int fuWinIni ); } "@ [Wallpaper]::SystemParametersInfo( 20, 0, $WallpaperPath, 0x01 -bor 0x02 ) | Out-Null if ("Microsoft.PowerShell.PSConsoleReadLine" -as [type]) { [Microsoft.PowerShell.PSConsoleReadLine]::ClearHistory() }