Command to change background colour on Windows 2008 R2 Server

Posted on 2011-10-06
Medium Priority
Last Modified: 2012-05-12
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.
Question by:NetToken
  • 4
  • 2

Expert Comment

ID: 36929819
just create gpo so that it changes when a user logs onto it?

LVL 26

Expert Comment

ID: 36929914
I tested the same on my labs with the OS: "Windows Server 2008 R2" 64 bit...it 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!
LVL 26

Accepted Solution

e_aravind earned 2000 total points
ID: 36929923
Even the refresh @ the Desktop is also getting the change.

> can you check if the values are getting added correctly @ the registry location?
Technology Partners: 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!


Author Comment

ID: 36932225

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.

Author Comment

ID: 36932322
Forget about my request for the command to logoff users.   I just figured out the command is "logoff".  Duh, I should know better.

Author Comment

ID: 36934612
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.  

Author Closing Comment

ID: 36934632
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.

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was supporting a handful of Windows 2008 (non-R2) 2 node clusters with shared quorum disks. Some had SQL 2008 installed and some were just a vendor application that we supported. For the purposes of this article it doesn’t really matter which so w…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question