Set a wallpaper @ Xp machine by script.
hey every1. B)
i got a problem. the place there i work we have win 2k. they work fine whit our policys. tho we are in the phase to go over to xp plattform. so the policys doesnt work on xp….
so now i need a script to be run at those xp machines to set a different wallpaper than the one on the 2k machines.
and no i wont make an other policy. (just working here for the summer… ;))
Any ideas?
Greets T0bbz0n
I found the code, it was actually designed to change the background when the desktop properties window is disabled.
Dim strFileName, strPath, strFilter
msgbox "Information:" & vbcrlf & vbcrlf & "Following this message box " & _
"a dialog box will open, choose the picture you want to set as " & _
"the desktop wall paper and click open", VbInformation, _
"VBS Wallpaper Change - Info"
strPath = "C:\"
strFilter = ""
sFileName = openDialog(sPath,sFilter)
if sFileName = "" then
msgbox "Desktop wallpaper file not specified, Wallpaper not changed", VbInformation, _
"VBS Wallpaper Change - Error"
else
Set oShell = CreateObject("WScript.Shell")
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sFileName
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
end if
Function openDialog(sPath,sFilter)
Dim oCD, intResult
Set oCD = CreateObject("UserAccounts.CommonDialog")
oCD.Filter = sFilter
oCD.InitialDir = sPath
oCD.Flags = &H80000 + &H4 + &H8
intResult = oCD.ShowOpen
openDialog = oCD.FileName
End Function
Save as whatever.vbs
I'm sure you can tweak it so that it forces a certain background picture at user logon ;)
This is also a good script to set up if you want a random background every time you log in. Just add a small set that will randomly choose a number from 1 - 10 and have all those numbers assign to a different background. again you will have to substitute your openDialog bit as well and know about VBScript