Link to home
Start Free TrialLog in
Avatar of NetToken
NetToken

asked on

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.
Avatar of zippybungle2003
zippybungle2003
Flag of United Kingdom of Great Britain and Northern Ireland image

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

http://www.techieshelp.com/set-desktop-background-colour-with-a-gpo/
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!
ASKER CERTIFIED SOLUTION
Avatar of e_aravind
e_aravind
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NetToken
NetToken

ASKER


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.
Forget about my request for the command to logoff users.   I just figured out the command is "logoff".  Duh, I should know better.
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.  
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.