Bart Simons

Bart Simons

Thoughts, stories and ideas.

Bart Simons



.net .net 5 .net core Apache C# CentOS LAMP NET Framework Pretty URLs Windows Server WireGuard access log add analysis android api at the same time authentication authorization automate automation azure azurerm backup bash basics batch bootstrap build capture cheat sheet chromium chroot class cli click to close code coverage code snippet command line commands compile compiling compression containers control controller controlling convert cpu usage create credentials csv csvparser curl data dd deployment desktop detect devices disable diskpart dism distributed diy docker dom changes dotnet core drivers ease of access encryption example export file transfer files fix folders framework generalize getting started ghost gui guide gunicorn gzip html html tables icewarp igd imagex import inotify install installation interactive ios iphone itunes java javascript jquery json kiosk kotlin linux live load data loading screen lock screen loopback audio lxc lxd lxml macos manage manually message messages minio mirrored mod_rewrite monitor monitoring mstest mutationobserver mysql net 5 nexmo nginx no oobe node node.js nodejs not installing notification notifications object storage on desktop one command openssl owncloud parallels parallels tools parse perfect philips hue play port forwarding powershell processing ps-spotify python quick raspberry pi record rip ripping rsync rtmp save save data sbapplication scraping script scripting scriptingbridge scripts security send server service sharedpreferences sms songs sonos spotify spotify api spotlight ssh stack streaming streamlink studio sudo swarm swift sync sysprep system audio systemd tables terminal testing tracking tutorial twilio ubiquiti ubuntu ubuntu 18.04 ui code unifi unlock unsplash source upnp uptime usb tethering wallpapers wasapi website websites webview windows windows 10 without itunes without oobe workaround xaml

Windows 10 Lock Screen Wallpapers On Your Desktop

If you use Windows 10, you probably know about Windows Spotlight, the feature that automatically fetches beautiful wallpapers for on your lockscreen. But, we're not left out with any option to set the desktop wallpaper to Windows Spotlight photos by default! Luckily, I've written a really nifty little PowerShell script that actually gets the job done.

<# LockScreenWallpaperToDesktop.ps1 #>

$SystemWallpaperCode = @"
using System.Runtime.InteropServices;
public class Wallpaper
    public const int SetDesktopWallpaper = 20;
    public const int UpdateIniFile = 0x01;
    public const int SendWinIniChange = 0x02;
    [DllImport(`"user32.dll`", SetLastError = true, CharSet = CharSet.Auto)]
    private static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni);
    public static void SetWallpaper ( string path )
        SystemParametersInfo( SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange );

Add-Type -TypeDefinition $SystemWallpaperCode

$MinimumFileByteSize = 320000

$LockScreenWallpapersLocation = "$env:LOCALAPPDATA\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"

$WallpaperFile = (Get-ChildItem $LockScreenWallpapersLocation | where { $_.Length -gt $MinimumFileByteSize } | Get-Random)[0]


Copy-Item "$LockScreenWallpapersLocation\$wallpaperFile" "$env:USERPROFILE\wallpaper.png"

Bart Simons

Bart Simons

View Comments