Lightweight Powershell Windows Desktop Background Rotator script

Martin Brinkmann
Feb 8, 2017

Windows Desktop Background Rotator is a Powershell script for Windows that loads a wallpaper from a pool whenever it is run.

Windows itself ships with options to rotate backgrounds regularly, but the options are somewhat limited in this regard. While you can configure the operating system to rotate a pool of images as desktop backgrounds, there is no option to further customize the selection.

Say you would like to use different wallpapers for different times of the year. Can be done, but you need to adjust the pool of wallpaper images manually each time, or switch to different themes for that.

There are plenty of programs out there to change wallpapers. To name a few: Bgcall, Jellybean, WallPapa, Color Desker, Wallperizer, and Wally.

Windows Desktop Background Rotator

windows desktop background rotator

One of the main ideas of Windows Desktop Background Rotator is to use different pools of background images based on time periods.

You can configure the script to load a pool of background images for Christmas, Summer, Halloween, or any other time period or day you like.

The script has an advantage over dedicated programs for the job, as it runs only for as long as it needs to change the wallpaper on the desktop. Once done, it does not use any system resources anymore which is better obviously than a resident program that needs to run all the time even though it may change the background only once a day or even less frequently than that.

Downside is that you need to configure the script using an editor. It is not too difficult, but if you never came into contact with scripts before, it may be overwhelming.

Let me walk you through the steps of doing that:

First thing you do is download the script from the project's GitHub page. Note that it downloads with the .txt extension automatically which you need to remove either when the download prompt appears, or later on the system.

The Powershell script uses the folder Desktop Backgrounds within Pictures by default. You can keep it at that, and move your wallpapers there, or edit the path in the script. The function Get-Default-Pool sets the path there.

wallpaper path

My suggestion is to keep the default path, as it makes things easier. It is easy enough to copy your wallpaper images to the folder, or folders under the structure.

The next step depends on whether you want to use different pools of wallpaper images that the program loads depending on the date. If you don't skip the following step.

Step 1: Set up the folders for the different wallpaper pools

desktop backgrounds

Add folders to the main Desktop Backgrounds folder, e.g. Christmas, Birthday, Halloween and so on, and place your wallpaper images there.

A typical folder structure could look like this:

  • Desktop Backgrounds
    • Christmas
      • wallpaper1.jpg
      • secondwallpaper.jgg
    • Halloween
      • halloween1.jpg
      • scary.png

Step 2: Add the function to the script

wallpaper functions

You need to add the following function to the script.

Function Get-StarWars-Pool {
Get-ChildItem "$([Environment]::GetFolderPath(`"MyPictures`"))\Desktop Backgrounds\Starwars"

Make sure you replace "Starwars" with the folder name that you are using on your system. Place the new function below the Get-Default-Pool function so that it looks like this

Function Get-Default-Pool {
Get-ChildItem "$([Environment]::GetFolderPath(`"MyPictures`"))\Desktop Backgrounds" -Recurse | Where-Object {! $_.PSIsContainer -And $_.FullName -NotMatch "Starwars"}

Function Get-StarWars-Pool {
Get-ChildItem "$([Environment]::GetFolderPath(`"MyPictures`"))\Desktop Backgrounds\Starwars"

Add | Where-Object {! $_.PSIsContainer -And $_.FullName -NotMatch "Starwars" to the default function to block it from selecting backgrounds from the date-based folders. Change Starwars to the pool name that you have set.

Step 3: Add a start and end date

wallpaper dates

Locate the $Dates array, and add start and end date information to it.

$Dates = @(
"StartDate" = "2-01"
"EndDate" = "2-28"
"Pool" = "Starwars"

This would pull background images from the Starwars folder from February 1 to February 28. Repeat this step for any other wallpaper pool that you have added to the script.

Two date pools would look like this:

$Dates = @(
"StartDate" = "2-01"
"EndDate" = "2-28"
"Pool" = "Starwars"
"StartDate" = "12-01"
"EndDate" = "12-26"
"Pool" = "Christmas"

Step 4: Set Tile, Center, Stretch or NoChange (Optional)

stretch wallpaper

The script uses stretch automatically when it comes to loading wallpapers. If you think that is fine, skip this step. If you want another value instead, do the following:

Locate [Wallpaper.Setter]::SetWallpaper($ImageToUse.FullName, 2) near the end of the script, and change the 2 to another value.

  • 0 means tile.
  • 1 means center.
  • 2 means stretch.
  • 3 means no change.

Step 5: run the script

run powershell

I suggest you run the script to check if it works correctly. This can be done by right-clicking the edited Powershell script and selecting run with PowerShell from the context menu.

If you don't get an error, e.g. nothing happens, you may use it manually, or, set up a scheduled task instead to automate the process.

Step 6: creating a scheduled task

To create a new scheduled task, do the following:

  1. Tap on the Windows-key, type Task Scheduler, and select the entry from the list of results.
  2. Select Action > Create Task.
  3. Add a name, and optional description to the task on the first tab of the Create Task window.
  4. Switch to the Triggers tab, and click on the New button.
  5. Click on"on a schedule" at the top, and select on startup, or any of the other options there. This determines when the script is run by Windows.
  6. You can enable delay and repeat under advanced. Delay would change the background after the selected time period, repeat would run it regularly.
  7. Click ok.
  8. Switch to the Actions tab and click on the New button there.
  9. Add the Windows Desktop Background Rotator script under Program/script, and click ok.
  10. Click on ok to complete the setup.

Windows will run the script from now on based on the parameters that you have defined.

Closing Words

Setup of the script is not overly complicated, but it is not as easy as using a user interface to set up wallpaper pools. The main advantage the script offers is that it runs only when it changes wallpaper images on your desktop, and that you can define time-based periods in which custom wallpaper pools are used.

Now Read: The best wallpaper downloaders for Windows

software image
Author Rating
1 based on 1 votes
Software Name
Windows Desktop Background Rotator
Operating System
Software Category
Landing Page

Tutorials & Tips

Previous Post: «
Next Post: «


There are no comments on this post yet, be the first one to share your thoughts!

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.