Tuesday, July 23, 2013

Setting Desktop Background Colour Using Powershell.



Sometime i write about doing some task with Powershell and that task are just a “Registry Tweaks”, and those tweaks can be done using some other methods too.

The idea behind with these post and scripts are, that when we are writing a powershell script, that will be completely powershell based.

For example if i creating an “Windows Customization ” tool and i need to configure few settings, then that tasks should be done by Powershell Not by something else.


My today task was to set Desktop Background to be a specific colour.  First i was searching for how to do this using powershell and after a few minutes i have find that , that can be done by tweaking a registry key.

What we want to automate.?

we want to automate the below marked option “Change Background Colour”.

23-07-2013 19-53-16

What is current background colour.?

You can see in below picture that my current desktop background in “Dark Red”.

23-07-2013 19-57-55

Now lets Change the background to the “Green”.

The RGB Code for Green Colour is : 116 164 2

The Registry Key which holds the setting of background colour is “Background” located at “Hkey_Current_User\Control Panel\Colors”

Set-ItemProperty 'HKCU:\Control Panel\Colors' -Name Background -Value "116 164 2 "

Now run the above in Powershell console.

23-07-2013 20-05-39

Log off from your system and login again.

and here you go :)  after login back, we can see that our Desktop background colour is changed to the Green one :)

23-07-2013 20-08-28

Now, change the background colour of every laptop in your organization to  match with your company’s logos colour.


I hope that you will find it helpful.


Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.