This Windows PowerShell script automatically fetches the Bing image of the day and sets it as your desktop wallpaper.
The script uses the XML page of Microsoft Bing to download the images and directly applies them as your wallpaper.
The Set-BingWallpaper.ps1 script handles everything automatically:
- Downloads the current Bing image of the day
- Sets it as your desktop wallpaper immediately
- Skips downloading if today's image is already set as wallpaper
- Uses a fallback image if the download fails
The script supports several options which allows you to customize the behavior.
-
-localeGet the Bing image of the day for this region.Possible values
'auto','en-US','en-GB','fr-FR','de-DE','zh-CN'Default value
'auto'Remarks By using the value
'auto', Bing will attempt to determine an applicable locale based on your IP address. -
-resolutionDetermines which image resolution will be downloaded. If set to'auto'the script will try to determine which resolution is more appropriate based on your primary screen resolution.Possible values
'auto','1024x768','1280x720','1366x768','1920x1080','1920x1200'Default value
'auto' -
-downloadFolderDestination folder to download the wallpapers to.Default value
"$([Environment]::GetFolderPath("MyPictures"))\Wallpapers"(the subfolderWallpapersinside your default Pictures folder)Remarks The folder will automatically be created if it doesn't exist already.
If the script fails to download today's Bing image (for example, due to network issues), it can use a fallback image instead. To configure this:
- Create a file named
fallback.jsonin the same directory as the script - Add the following content, specifying the path to your desired fallback image:
{
"imagePath": "C:\\Path\\To\\Your\\Fallback\\Image.jpg"
}Replace the path with the full path to your preferred fallback image. Make sure to use double backslashes in the path.
Simply run the PowerShell script to immediately update your wallpaper:
.\Set-BingWallpaper.ps1Or customize it with parameters:
.\Set-BingWallpaper.ps1 -locale "en-US" -resolution "1920x1080" -downloadFolder "D:\Wallpapers"First, make sure that you can actually run PowerShell scripts.
You might have to set the execution policy to unrestricted by running
Set-ExecutionPolicy Unrestricted in a PowerShell window executed with
administrator rights.
Additionally, you might need to unblock the file since you downloaded
the file from an untrusted source on the Internet.
You can do this by running Unblock-File <path to the script> as
administrator.
Note that the script itself doesn't need to be run as administrator!
You can configure to run the script periodically using "Task Scheduler."
Open Task Scheduler and click Action ⇨ Create Task….
Enter a name and description that you like.
Next, add a trigger to run the task once a day.
Finally, add the script as an action.
Run the program powershell with the arguments -WindowStyle Hidden -file "<path to the script>" <optional script arguments>.
Unlike the older approach, you don't need to manually configure a slideshow - the script directly sets your wallpaper to the latest Bing image of the day.