VB Script to change the desktop wallpaper

Below is the script to change your desktop wallpaper. You just need to modify the script to point to the location where the 'wallpaper is located.

You can then include this script in your Domain's Group Policy's login or startup script.

 

' ----------------------------Script to change Desktop Wallpaper-----------------------------------------

dim wshShell
dim sUserName

Set wshShell = WScript.CreateObject("WScript.Shell")
sUserName = wshShell.ExpandEnvironmentStrings("%USERNAME%")

Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")

sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\Users\eskonr\Pictures\Nice-Windows-7.jpg"

' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper

' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True

msgbox "done"

 

You will have to change the bold letter (image file) with your image file path.

2 Responses to "VB Script to change the desktop wallpaper"

Leave a Reply