Project Description

A tool that can be run as a Windows Scheduled Task daily to pull down the Bing Daily Image or Video and sets it as your Windows wallpaper.

Requirements

For video, you will require VLC (VideoLAN to be installed - http://www.videolan.org/). The path to VLC is hard coded in the script. It is fairly obvious, so change it if you need to!

Setup

You should download this script and set it up as a Windows Scheduled task.

Instructions how to do this are here:
https://blogs.technet.microsoft.com/heyscriptingguy/2012/08/11/weekend-scripter-use-the-windows-task-scheduler-to-run-a-windows-powershell-script/

Miscellaneous

I've left the traditional lines of code in there for telling Windows to update the wallpaper after you set it in the registry, but this wasn't changing it every time for me, so I discovered a better way was to use a SystemParametersInfo function, SPI_SETDESKWALLPAPER.

Original Code to change Wallpaper
# Refresh wallpaper
rundll32.exe user32.dll, UpdatePerUserSystemParameters,1,True

New code
Add-Type -TypeDefinition @" 
using System; 
using System.Runtime.InteropServices;

public class Params
{ 
    [DllImport("User32.dll",CharSet=CharSet.Unicode)] 
    public static extern int SystemParametersInfo (Int32 uAction, 
                                                   Int32 uParam, 
                                                   String lpvParam, 
                                                   Int32 fuWinIni);
}
"@ 

$SPI_SETDESKWALLPAPER = 0x0014
$UpdateIniFile = 0x01
$SendChangeEvent = 0x02

$fWinIni = $UpdateIniFile -bor $SendChangeEvent 

$path = "C:\TEMP\MyImage.bmp"

$ret = [Params]::SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, $path, $fWinIni)

Source: http://stackoverflow.com/questions/28180893/how-to-change-wall-paper-by-using-powershell#28187071

Caveats

There are some hard coded paths which you can adjust manually