Created
November 10, 2021 11:45
-
-
Save daftspaniel/90ba1bcc4612af596bfe0b2e3fd624c6 to your computer and use it in GitHub Desktop.
Download and set the wallpaper from hexdsl.co.uk
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
# Change to image1 if you fancy a different wallpaper. | |
Invoke-WebRequest -Uri https://hexdsl.co.uk/image2.jpg -OutFile wall.jpg | |
# Pinched from Stackoverflow :-) | |
$setwallpapersrc = @" | |
using System.Runtime.InteropServices; | |
public class Wallpaper | |
{ | |
public const int SetDesktopWallpaper = 20; | |
public const int UpdateIniFile = 0x01; | |
public const int SendWinIniChange = 0x02; | |
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] | |
private static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); | |
public static void SetWallpaper(string path) | |
{ | |
SystemParametersInfo(SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange); | |
} | |
} | |
"@ | |
Add-Type -TypeDefinition $setwallpapersrc | |
[Wallpaper]::SetWallpaper((Get-Item .\wall.jpg).fullname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment