The script seems to work fine on XP but doesnt work on win2k and
win98. The registries seem to be changing fine but the background
doesnot refresh with the rundll32 userdll call on the last line. Am I
missing anything ??
Please help!! Thanks,
NK
----------------------
----------------------
Dim WshShell, wpFile, wpStyle
set WshShell = CreateObject("Wscript.Shell")
'change this parameter for the destination wallpaper
wpFile = "%windir%\web\wallpaper\dt1.bmp"
'wallpaper style 2-stretch, 1-center;
wpStyle = 2
WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper",wpFile
WshShell.RegWrite "HKCU\Control Panel\Desktop\WallpaperStyle",wpStyle
WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control
Panel\Desktop\Wallpaper",wpFile
WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control
Panel\Desktop\WallpaperStyle",wpStyle
'WScript.Echo WshShell.RegRead("HKCU\Control Panel\Desktop\Wallpaper")
'msgbox (WshShell.RegRead("HKCU\Control
Panel\Desktop\WallpaperStyle"))
WshShell.Run _
"%windir%\System32\RUNDLL32.EXE
user32.dll,UpdatePerUserSystemParameters", _
1, False
----------------------
----------------------
> Iam not an expert in VBscripting, and I am trying to set a wallpaper
> and refresh it (without the user logoff) on winXP, win200 pro, and
> win98 using the following script (coz of company marketing strategy).
> Iam pushing this script via installshield to more than 1000 computers
> with any of above os'.
>
> The script seems to work fine on XP but doesnt work on win2k and
> win98. The registries seem to be changing fine but the background
> doesnot refresh with the rundll32 userdll call on the last line. Am I
> missing anything ??
Hi
The rundll32 UpdatePerUserSystemParameters works for me on Win2k to refresh the
wallpaper, but as for Win98, it is not supported.
Try this free command line utility instead, it should work for all your OS
versions:
Set Wallpaper (SetWallpaper.exe)
http://www.optimumx.com/download/
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
Thanks for the tip. But is there a way to update / refresh via win32
api ? Any script or help available ? The script above seems more like
a hack than the actual way of achieving.
All help / thoughts are appreciated,
truly,
nk
The system has to be informed of the change so that Explorer will
know to reload. There is an API method to do that but it can't be done
from script. A script cannot call API methods directly. If you want to use
a component see JSSys3.dll at
www.jsware.net/jsware/scripts.html
It might also work to use Sendkeys on the Display CPL after
doing the Registry settings, in order to update the change,
but I'm not sure.