I use Windows 10 for my main PC and the lock screen images from Windows Spotlight are often beautiful so I wanted to look into how to use those pictures as desktop backgrounds. I found an existing HowToGeek article for this, but it gave a manual solution so today we’re here to automate that with a bit of PowerShell.

We are going to do the following:

  • Enable Windows Spotlight
  • Download and test the PowerShell script
  • Update our background settings to use the images as a slideshow
  • Setup a Scheduled Task to automate the update of the Spotlight images to the slideshow

Enable Spotlight

For this to work, Spotlight needs to be enabled. This is what gets Windows to download the Spotlight images into a local cache directory. If you have Spotlight enabled already, you do not need to complete this step.

The HowToGeek article explains this in detail, but in my version of Windows 10 you can jump straight to the setting by searching “Choose Windows Spotlight”.

search menu start

Ensure that Windows Spotlight is selected as the Lock Screen background.

lock screen set

Note that if you are enabling Spotlight for the first time you may need to wait for a couple of days for images to appear. As described in the HowToGeek article, you will find them in the location below. Paste that into a File Explorer bar if you want to check and see if you have any files already cached.

%USERPROFILE%\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets

Install and test the script

Below is the full script that we are going to use.

For the purposes of this exercise we are going to install it to %USERPROFILE%\get-spotlight\scripts. We are also going to create a folder for our Spotlight images to use with the slideshow later. In a PowerShell terminal, use the following commands to create the directory structure and download the gist:

1
2
3
4
mkdir $env:USERPROFILE\get-spotlight
mkdir $env:USERPROFILE\get-spotlight\scripts
mkdir $env:USERPROFILE\get-spotlight\images
wget https://gist.githubusercontent.com/jdcockrill/9d254c7cd53bb7203042e107d05549db/raw/8bbd71d15286919d4424175e6af35e97052b8f86/get-spotlight.ps1 -OutFile $env:USERPROFILE\scripts\get-spotlight.ps1

Before scheduling it, we’ll run the script to make sure it works. To do that we need to learn about the parameters the script expects.

It’s worth noting that Spotlight seems to include both Desktop and mobile-phone wallpapers, so the script provides switches to allow you to choose which type of wallpaper you want to copy.

  • $out is mandatory and is the directory that the images are copied to. In our case this is going to be $env:USERPROFILE\get-spotlight\images
  • $KeepDesktopWallpaper indicates to the script that the Desktop (landscape orientated) wallpapers should be copied
  • $KeepPhoneWallpaper indicates to the script that the mobile phone (portrait orientated) wallpapers should be copied
  • One of $KeepDesktopWallpaper or $KeepPhoneWallpaper must be present

To test our script out, we will run the following command:

cd $env:USERPROFILE\get-spotlight\scripts
.\get-spotlight.ps1 -out $env:USERPROFILE\get-spotlight\images\ -KeepDesktopWallpaper

If successful, we should find a bunch of images in $env:USERPROFILE\get-spotlight\images.

Setup the Background Slideshow

Search for “Background” in the Start Menu and you will be taken to the Background screen in Settings.

background settings

Change your settings to match those above:

  • Background should be set to Slideshow
  • Browse to the %USERPROFILE%\get-spotlight\images directory for Choose albums for your slideshow
  • Set Change picture every to a time delay of your choice
  • Under Choose a fit I use Fill but you can experiment to find setting best for your setup.

Setup Scheduled Task

The last part that remains is to setup a Scheduled Task to run the script. This ought to be easy enough. Search for “Task Scheduler” in the Start Menu and open it up.

  • Click on Create Basic Task (you can use Create Task… as well, it’s just a bit more complicated)
  • Give it a nice name. Something like Get Spotlight Images
  • Set up a Daily trigger of your choosing - the images don’t change more frequently than that anyway so Daily should be enough
  • Under Action we want to Start a program and under Start a program we need to browse to our get-spotlight.ps1 script that we created earlier
  • In Add arguments we need to set our command-line arguments. These will be as below:
-out %USERPROFILE%\get-spotlight\images -KeepDesktopWallpaper

With the Scheduled Task in place we now have our desktop background setup to use a slideshow of Windows Spotlight images that you typically see on your lock screen, automatically updated by our PowerShell script and Scheduled Task.