Windows Spotlight is a lock screen feature that highlights photography from famous, historical, and natural landmarks. Being on the lock screen, these can only show while your device is unused and idle, but with this tip, you can enjoy a these daily images on your desktop wallpaper too.  

Update: want to skip the nerdy details and just set it up? Skip to the end for the steps.

Windows Spotlight periodically downloads pictures, but they aren’t exactly meant to be casually browsed through. While accessing these Spotlight lock screen pictures has been a well publicized tip, most articles only describe the manual process of reaching the images.  For reference, they are stored at the path below, which you can paste into your Run box or File Explorer address bar to reach:

%LocalAppData%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets

The images also lack file name extensions — .jpg in this case — meaning you need to rename the files before you can easily open them in your image viewer.

Spotlight lock screen images are always vivid and beautiful.

Scripting it

I had previous distilled the above steps down to a single PowerShell line which blindly copies every file in the Assets folder to a folder called “Pics” in my OneDrive, appending “.jpg” to each file name (whether it should be a JPEG or not).

Get-ChildItem -Path $env:localappdata\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets | Copy-Item -dest {"$home\onedrive\desktop\pics\" + $_.BaseName + ($i++) +".jpg" }

This worked okay. After running, I could open the Pics folder, sort by an attribute like width to find the landscape desktop pictures, and discard the rest.  But enterprising scripters have done better.  On Reddit, a 50-line Windows Shell Script handles the job… verbosely. But with PowerShell, this 20-line gem goes one step further by removing images that aren’t big enough to be wallpapers:

$files = gci $Env:LocalAppData\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets | where Length -gt 1kb

if ($files) {
    $shell = New-Object -ComObject Shell.Application
    $folder = "$Env:USERPROFILE\OneDrive\Pictures\Wallpaper\Spotlight\"
 
    if (!(Test-Path $folder)) { mkdir $folder }

    $files | % {
        $_ | Copy-Item -Destination $folder\$_.jpg
        Get-Item $folder\$_.jpg
    } | % {
        $namespace = $shell.namespace($folder)
        $item = $namespace.ParseName($_.Name)
        $size = $namespace.GetDetailsOf($item, 31)
        if ($size -match '(\d+) x (\d+)') {
            $width = [int]($Matches[1])
            $height = [int]($Matches[2])
        }
        if (!$size -or $width -lt 1920 -or $height -lt 500) {
            Remove-Item $_
        }
    }
}

Automating it

Awesome, right!?  Now we just need to schedule this to run periodically to collect any new pictures for us.  First, we’ll save the script above as a .ps1 text file or download it here.  Remember to set the output folder where you like. I used %UserProfile%\OneDrive\Pictures\Wallpaper\Spotlight.

Womp Womp. For security, running scripts is disabled unless you say the magic word.

To test the script, we can run it on demand. Because executing scripts could be dangerous, they are not enabled by default. We’ll use the bypass command shown below to temporarily bypass this policy the purposes of running this individual script.

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file "C:\Path\SaveSpotlight.ps1"

To schedule this to run by itself, open up Task Scheduler and create a new task (you can see I like to first create a folder for my own automatic tasks).  The trigger can be anything you like, I used daily at 11:55pm personally.  On the Actions, you’ll need to use the same bypass parameter.  To do this, specify the path to PowerShell, then use the arguments box to specify the bypass and path to the actual script file, as shown in the pictures below.  You can also get the task file here and import it.

Bringing it all together

Once saved, you can test your task and make sure the pictures output as you like.  By setting your desktop wallpaper to slideshow and selecting the same folder as this script outputs, you can enjoy an endless slideshow of the spotlight pictures.  I’ve already used it to collect all this great wallpaper eye candy.

Just a few of the Spotlight pictures I’ve collected over the past few months.

How to set it up yourself

If scripts, PowerShell, and Task Scheduler aren’t doing it for you, maybe this will: setting up an automatic and always-fresh desktop slideshow of these beautiful pictures takes just a couple minutes. Here’s what you need to do:

  1. Download the SaveSpotLight.ps1 PowerShell script file. You’ll need to keep this file, so I’d suggest putting it into your Documents folder, perhaps in a new folder called “Scripts”. I wouldn’t recommend keeping it in your downloads or desktop, since you won’t want this file to get touched or cleaned up by mistake.
  2. In your OneDrive pictures folder, make a folder called Wallpaper, then inside that one more folder called Spotlight. For example: c:\users\jdoe\onedrive\pictures\wallpaper\spotlight
  3. Download the Copy Spotlight Pictures Task.xml Task Scheduler file. This is only needed once, so I’d put it on your Desktop so you can easily delete it later.
  4. Open Task Scheduler, click Import Task, and select the file from step 3.  Set the trigger as you like (I used 11:55pm daily).  On the Actions tab, make sure the arguments box ends with the correct location of the script you saved in step 1.
  5. Right-click your wallpaper and choose Personalize. Choose “slideshow” for the background type, and browse to select your Spotlight folder (or the location you picked in step 2).  You can also set how often to swap pictures, and if you’d like to see them shuffled randomly.
  6. Delete the Copy Spotlight Pictures Task file from your desktop.

Video Demo:


Related Reading

If you’re in the mood for nostalgic wallpapers, check out these vintage Windows 95/98 Plus! Pack Themes for Modern Windows complete with themes, cursors, sounds, colors, and backdrops:

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.