SHARE
TWEET

Ducky Mimie

Maparoleamoi Jul 14th, 2019 (edited) 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  2. (new-object System.Net.WebClient).DownloadFile('https://file1.closermag.fr/var/closermag/storage/images/1/2/5/7/0/12570970/mais-oui-mimie-mathy-est-plus-badass-que-les-men.jpg',"$Env:Temp\\b.jpg");
  3. Add-Type @"
  4. using System;
  5. using System.Runtime.InteropServices;
  6. using Microsoft.Win32;
  7. namespace Wallpaper {
  8.    public enum Style : int {
  9.        Tile, Center, Stretch, NoChange
  10.    }
  11.    public class Setter {
  12.        public const int SetDesktopWallpaper = 20;
  13.        public const int UpdateIniFile = 0x01;
  14.        public const int SendWinIniChange = 0x02;
  15.        [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
  16.        private static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
  17.        public static void SetWallpaper(string path, Wallpaper.Style style) {
  18.            SystemParametersInfo(SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange);
  19.            RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\\\Desktop", true);
  20.            switch (style) {
  21.                case Style.Stretch:
  22.                    key.SetValue(@"WallpaperStyle", "2");
  23.                    key.SetValue(@"TileWallpaper", "0");
  24.                    break;
  25.                case Style.Center:
  26.                    key.SetValue(@"WallpaperStyle", "1");
  27.                    key.SetValue(@"TileWallpaper", "0");
  28.                    break;
  29.                case Style.Tile:
  30.                    key.SetValue(@"WallpaperStyle", "1");
  31.                    key.SetValue(@"TileWallpaper", "1");
  32.                    break;
  33.                case Style.NoChange:
  34.                    break;
  35.            }
  36.            key.Close();
  37.        }
  38.    }
  39. }
  40. "@
  41. [Wallpaper.Setter]::SetWallpaper("$Env:Temp\b.jpg" , 2 )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top