Created
November 10, 2021 11:45
-
-
Save daftspaniel/90ba1bcc4612af596bfe0b2e3fd624c6 to your computer and use it in GitHub Desktop.
Revisions
-
daftspaniel created this gist
Nov 10, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ # 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)