Command to change background colour on Windows 2008 R2 Server

I need to change the background color of my Windows Server 2008 R2 desktop via a text command in a batch file.  I done this before on a Windows XP computer using the following command to modify the associated registry key...

reg add "HKCU\Control Panel\Desktop" /v Wallpaper /d "C:\wallpaper\background1.bmp" /f

But this command doesn't work on the Server 2008 R2 O/S.  Is there a way make this kind of display change in a text command that can be run from a batch file on Server 2008 R2?  

I will also need the remote desktop users connecting to this server to be able to run the command to change their Windows desktop background color.

I know how to change the Windows background color manually through the (Control Panel\Appearance\Display\Desktop Background), but I need to run it in a batch file which is used to switch users to a backup application server.  

The backup server is intended for only reading data but there's no way to prevent saving data into it.  I want to change the desktop background color from blue to red so it will alert users that they are on the read only server.  The blue background will let them know they are on the production server.
Who is Participating?
Even the refresh @ the Desktop is also getting the change.

> can you check if the values are getting added correctly @ the registry location?
just create gpo so that it changes when a user logs onto it?
I tested the same on my labs with the OS: "Windows Server 2008 R2" 64 worked fine

Initially after running the command...don't expect this to change the backgroud immediately
(but at this time the registry value is getting changed...still the same session is not showing-up this change)

Ask the "Terminal server users" to disconnect the session (mstsc session)
Reconnect the "terminal server" again with the same creds.. you should be able to see the background change!
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

NetTokenAuthor Commented:

Thanks for getting back to me about this guys.  Last night I located the registry key that changes when you manually select desktop background colors in [Control Panel\Appearance\Display\Desktop Background].  

The key is "HKEY_CURRENT_USER\CONTROL PANEL\Colors\Background".   After setting the desired colors I found the key codes for:  Blue = 10 59 118  and  Red = 184 40 50.

I'd rather use a text command that would change these registry key values rather than pasting bitmap colors to the desktop from a file.   I'm not knowlegable enough to know how to write a command that can change this registry key.  Would one of you please provide me with the command to do this?

Also, could you give me a command which would log the users off the Terminal Server after the background color change is made?

Thanks again for your help.
NetTokenAuthor Commented:
Forget about my request for the command to logoff users.   I just figured out the command is "logoff".  Duh, I should know better.
NetTokenAuthor Commented:
I should have answered zippybungle2003's suggestion about changing the GPO policy.  That a good idea but I'm just looking to augment a batch command file so that selected users will be able to quickly switch database servers.

In this case the application is running on a terminal server with the databases residing on a different server.  I'm using the a batch file that modifies the %Windir%\SYSTEM32\DRIVERS\etc\hosts file.  But I also need a simple way to alert users they are on the backup server.  Rigiht now I'm thinkng about changing the default Active window color to red for a more noticeable indicator.

I'm believe that "e_aravind" should get the 500 points for this one as he not only answered my question but went to the trouble of testing the (registry add) command on a server in his labs.  
NetTokenAuthor Commented:
Thanks e_aravind,

I may have to verify this on another TS; but even though I see the new registry entry, it doesn't appear to affect the background color of the (non-administrator) user's profile.   Although this could be due to some GPO setting meant to prevent users from changing desktop wallpaper in their profile.

Sorry about the (logout) question, I don't think straight Friday afternoons at work.
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.