• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7060
  • Last Modified:

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.
0
NetToken
Asked:
NetToken
  • 3
  • 2
  • 2
1 Solution
 
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
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now