Created
May 15, 2016 11:24
-
-
Save Workshop2/4fa2fda523b628cb836b1c45111322f4 to your computer and use it in GitHub Desktop.
Set wallpaper to today's Bing wallpaper (en-GB)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$wallpaperOutput = "$env:USERPROFILE\Pictures\wallpaper.jpg" | |
Write-Output "Downloading data feed..." | |
$wallpaperData = "http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-GB" | |
$json = (Invoke-WebRequest $wallpaperData -UseBasicParsing) | ConvertFrom-Json | |
$wallpaperUrl = "http://www.bing.com" + $json.images.urlbase + "_1920x1080.jpg" | |
Write-Output "Generated wallpaper URL: $wallpaperUrl" | |
Write-Output "Downloading wallpaper..." | |
Invoke-WebRequest $wallpaperUrl -OutFile $wallpaperOutput -UseBasicParsing | |
Write-Output "Setting registry key...HKCU:\Control Panel\Desktop\ -> wallpaper -> $wallpaperOutput" | |
Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $wallpaperOutput -force | |
rundll32.exe user32.dll, UpdatePerUserSystemParameters | |
rundll32.exe user32.dll, UpdatePerUserSystemParameters | |
rundll32.exe user32.dll, UpdatePerUserSystemParameters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment