Batch Downloading Wallpapers using PowerShell

0

Get bored with your desktop wallpaper but don’t feel like change them manually every time? Here is a way to automate the process of downloading wallpapers from Wallpapers Wide website and setting them up as desktop wallpaper slide show.

Download PowerShell script

First, download the following PowerShell script by clicking the download button.

Here is the source code, credit to PowerTips.

function Download-Wallpaper
{
    param
    (
        [string]
        [Parameter(Mandatory)]
        $Folder,
 
        [Parameter(ValueFromPipeline)]
        [Int]
        $Page=1
    )
    
    begin
    {
        $url = "http://wallpaperswide.com/page/$Page"
        $targetExists = Test-Path -Path $Folder
        if (!$targetExists) { $null = New-Item -Path $Folder -ItemType Directory }
    }
    process
    {
        $web = Invoke-WebRequest -Uri $url -UseBasicParsing
 
        $web.Images.src | 
        ForEach-Object {
    
            $filename = $_.Split('/')[-1].Replace('t1.jpg','wallpaper-3840x2160.jpg')
            $source = "http://wallpaperswide.com/download/$filename"
    
            $TargetPath = Join-Path -Path $folder -ChildPath $filename
 
            Invoke-WebRequest -Uri $source -OutFile $TargetPath
        }
    }
    end
    {
        explorer $Folder
    }
}

Download-Wallpaper -Folder d:\temp\wallpaper

By default, all wallpapers will be downloaded and saved in d:\temp\wallpaper folder. Change it to the place of your choice on your computer.

To run the script, right-click the downloaded wallpaper-dl.ps1 file and choose Run with PowerShell from the context menu.

Run with PowerShell - Batch Downloading Wallpapers using PowerShell

The PowerShell window pops up and you will see the download process flashing inside it.

PowerShell download image - Batch Downloading Wallpapers using PowerShell

Once done, you will have a set of high-definition wallpapers ready for you to enjoy.

Setup Background slideshow

Now open Settings app, go to Personalization > Background. Select Slideshow as the Background type and Browse to set the folder that stores all downloaded wallpaper files as the album for the slideshow.

Settings Personalization Background slideshow Browse - Batch Downloading Wallpapers using PowerShell

Automate the download process

To automate the download process, you can use Task Scheduler to set up a schedule for wallpaper-dl.ps1 file to run periodically.

Open Task Scheduler, create a new task and edit the Action tab to use PowerShell as the program with the script file path as the arguments, like below:

Create Task Action - Batch Downloading Wallpapers using PowerShell

Lastly, if PowerShell isn’t your thing, how does Automatically Save Windows Spotlight and Bing Images as Desktop Wallpaper sound?

SHARE

LEAVE A REPLY

Please enter your comment!
Please enter your name here