Created
August 12, 2022 14:58
-
-
Save milk-truck/412240307b8efd69ca0634bc14de8d2e to your computer and use it in GitHub Desktop.
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 characters
#-------------------------------------------------------------------# | |
# ScriptName : SetWall.ps1 # | |
# Description : Force a Desktop wallpaper Refresh # | |
# Credits : Unknown (if you know original creator, let us know) # | |
# # | |
# Date : 01 July 2020 # | |
#-------------------------------------------------------------------# | |
#Modify Path to the picture accordingly to reflect your infrastructure | |
$imgPath="\\Domain.lab\netlogon\Wallpaper.png" | |
$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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment