Need command to refresh wallpaper after it's been changed in registry...

I looking for a text command that will let me refresh the Windows wallpaper in Server 2008 R2 after it has been changed in the registry via a text command.  

I've come up with the following two commands which change the Windows wallpaper...

    reg add "HKCU\Software\Microsoft\Internet Explorer\Desktop\General" /v  
     Wallpaper /d "C:\BatchFiles\background.bmp" /f

    reg add "HKCU\Software\Microsoft\Internet Explorer\Desktop\General" /v
     Wallpapersource /d "C:\BatchFiles\background.bmp" /f

The next command works on Windows XP for refreshing the screen after the desktop wallpaper has been changed using a similar (reg add) command...
     
     RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True

Unfortunately, that command doesn't work in Server 2008 R2.

I've found that even logging off & back onto the server doesn't update the wallpaper change.  However,  by simply going into "Control Panel\All Control Panel Items\Display\Desktop Background" will immediately effect the wallpaper change.

I'm doing this for a project at work so any assistance is greatly appreciated.
NetTokenAsked:
Who is Participating?
 
sjklein42Commented:
The best way to change the desktop background programmatically is using the Win32 API. The Win32 API is supported by Microsoft and unlikely to change in next versions of Windows:

SystemParametersInfo Function
http://msdn.microsoft.com/en-us/library/ms724947(VS.85).aspx

(Parameter SPI_SETDESKWALLPAPER.)

http://social.technet.microsoft.com/Forums/ar/w7itproui/thread/c5979d78-9732-41a7-8f7b-a9991e318b76


There must be a tiny freeware program out there that does it, but I haven't been able to find it.
0
 
NetTokenAuthor Commented:
I'm just trying to put together a quick and dirty way to switch wallpaper on the fly as part of a simple command batch file.  I would even be willing to try a command which will launch the "Control Panel\All Control Panel Items\Display\Desktop Background" screen as a quick fix.  Changing the desktop background is just the last step in a series of operations I've already configured (and tested) in this batch file.

I've got everything in the batch file working perfectly on Windows XP clients, but so far solving this problem on a Terminal server running Windows 2008 R2 64bit has me stumped.  

Does someone here know how to code a command to launch the desktop wallpaper selection screen?

0
 
sjklein42Commented:
Try this DOS command:

control.exe desk.cpl,@0,0

Open in new window

0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
Rob MinersCommented:
I tried changing my background with
reg add "HKCU\Software\Microsoft\Internet Explorer\Desktop\General" /v WallpaperSource /d C:\107.jpg /f
 and it didn't change. Then I tried the location below
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /d C:\107.jpg /f

 in Windows 7 and then I hit F5 to refresh and it was there.
0
 
NetTokenAuthor Commented:
I tried the "control.exe desk.cpl,@0,0" on the Windows 2008 R2 server and it returned the destop icon selections which didn't update the wallpaper.  I ran the command with all the other .CPL's in the SYSTEM32 folder.  It returned some interesting screens; like the network adapters panel.

I believe you were correct that this problem may require a procedure call to an external utility.  That makes this a programming question, best asked in another zone:

I'm going to give this one to sjklein42 for pointing me in the right direction.

Thanks for the assist rrjmin0, I tried your Windows 7 solution but unfortunately doing the same thing doesn't work on Server 2008 R2.
0
 
Rob MinersCommented:
Thats cool and good luck with your future endeavors :)
0
 
sjklein42Commented:
You can experiment changing the second 0 to another number (ie 1-5) to bring up the other tabs in the control panel.  The tab numbers appear to be different depending on the version of Windows.

control.exe desk.cpl,@0,1 

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.