Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Modify Path to the picture accordingly to reflect your infrastructure
- $imgPath="C:\windows\temp\b.bmp"
- $code = @'
- using System.Runtime.InteropServices;
- namespace Win32{
- public class Wallpaper{
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ;
- public static void SetWallpaper(string thePath){
- SystemParametersInfo(20,0,thePath,3);
- }
- }
- }
- '@
- add-type $code
- #Apply the Change on the system
- [Win32.Wallpaper]::SetWallpaper($imgPath)
- for($i=1;$i -le 50;$i++){rundll32.exe user32.dll, UpdatePerUserSystemParameters, 1, true;Start-sleep -s 2}
- for($i=1;$i -le 50;$i++){rundll32.exe user32.dll, UpdatePerUserSystemParameters;Start-sleep -s 2}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement