Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Automatically set your wallpaper to NASA’s picture of the day
- # http://ps1tips.com/post/117087166929/automatically-set-your-wallpaper-to-nasas-picture
- # The first step in order to fetch NASA’s Astronomy Image of the Day is to have an API key. You can get one from https://data.nasa.gov/developer although the DEMO key below will work for now.
- # Let’s make a call to the API endpoint and parse the JSON data:
- $a = Invoke-WebRequest -Uri https://api.data.gov/nasa/planetary/apod?api_key=DEMO_KEY | ConvertFrom-Json
- # Now that our variable contains a URL and date, we can select a path where to save the image, and then download it:
- $path = "$($env:temp)\$($a.date).jpg"
- Invoke-WebRequest -Uri $a.url -OutFile $path
- # Finally, we change the Registry value and reload user settings to set the wallpaper:
- Set-ItemProperty -path "HKCU:\Control Panel\Desktop\" -name wallpaper -value $path
- rundll32.exe user32.dll, UpdatePerUserSystemParameters
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement