Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set desktop on workstation with VB script

Status
Not open for further replies.

TheNewOne

Technical User
Mar 27, 2004
117
SI
Hy forum. Any idea how to script this problem: I would like to set desktops in my organization with login VB script. I know how to add shortcuts to users desktop, but I have no idea how to set users background on workstation. Can some expert there give me direction where to start?? Thx
 
This script adds registry entries pointing to a stored bmp on the machines hard drive, it changes the logon screen background and the desktop background, hope this is useful to you:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite"HKEY_USERS\.DEFAULT\Control Panel\Desktop\Wallpaper","C:\test.bmp","REG_SZ"
WshShell.RegWrite"HKEY_USERS\.DEFAULT\Control Panel\Desktop\WallpaperStyle","0","REG_SZ"
WshShell.RegWrite"HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper","C:\test.bmp","REG_SZ"
WshShell.RegWrite"HKEY_CURRENT_USER\Control Panel\Desktop\WallpaperStyle","0","REG_SZ"
wscript.echo "Wallpaper settings have been changed"
 
Oh the 0 value can be changed to 1 or 2 depending on whether you want your background to be tiled, stretched etc....
 
Thx for your reply teckiejon. I forget to tell that we use W2k OS in our organization. Im getting an error "Invalid root in registry key ...."
 
This should work it creates a new reg key and gives it the relevant detail:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite"HKEY_CURRENT_USER\Software\Microsoft\Windows\Currentversion\Wallpaper","C:\test.bmp","REG_SZ"
wshShell.Regwrite"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\WallpaperStyle","0","REG_SZ"
wscript.echo "Wallpaper settings have been changed"

Hope this works a bit better for you!
 
Thx for help teckiejon. Script works perfect. Do you maybe know wich registry values you must edit to set desktop background colour???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top