Command to change background colour on Windows 2008 R2 Server

Posted on 2011-10-06
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
    LVL 5

    Expert Comment

    just create gpo so that it changes when a user logs onto it?
    LVL 26

    Expert Comment

    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!
    LVL 26

    Accepted Solution

    Even the refresh @ the Desktop is also getting the change.

    > can you check if the values are getting added correctly @ the registry location?

    Author Comment


    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

    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

    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

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Want to promote your upcoming event?

    Is your company attending an event or exhibiting at a trade show soon? Are you speaking at a conference? Spread the word by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

    Suggested Solutions

    I had a question today where the user wanted to know how to delete an SSL Certificate, so I thought that I would quickly add this How to! Article for your reference. WHY WOULD YOU WANT TO DELETE A CERTIFICATE? 1. If an incorrect certificate was …
    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…
    This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
    This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now