You are here

Group Policy ADM to set the desktop wallpaper and the desktop colour

up
0 users have voted.

For some time I have been using a group policy and Active Desktop to set users Wallpapers however Active desktop is far from perfect.

So instead I have now started using the attached ADM to specify the desktop wallpaper and the desktop background colour.

The downside of not using Active Desktop is only bitmap images are allowed.
 

 

CLASS USER
 
CATEGORY "Custom Desktop"
 
	POLICY "Desktop Wallpaper"
            KEYNAME "Control Panel\Desktop"
            EXPLAIN "Enter the path of .bmp file for desktop wallpaper and select the required style."
	    PART "Enter the full path below to a .BMP file" TEXT
            END PART
            PART "Wallpaper Path:" EDITTEXT
	        VALUENAME "Wallpaper"
	    END PART
            PART "Wallpaper Style:" DROPDOWNLIST REQUIRED
	        VALUENAME "WallpaperStyle"
		ITEMLIST
			NAME "Centered"	VALUE NUMERIC 0 DEFAULT
			NAME "Tiled"	VALUE NUMERIC 1
			NAME "Stretched"	VALUE NUMERIC 2
		END ITEMLIST
		NOSORT
	    END PART
        END POLICY
 
	POLICY "Desktop Background Color"
	    KEYNAME "Control Panel\Colors"
	    EXPLAIN "Enter the RBG value to serve as the Desktop background color, the format must be RED BLUE GREEN using a value between 0 and 255 for each color"
	    PART "R B G using a value 0-255 for each color eg 0 78 152." TEXT
        END PART
        PART "RBG Values:" EDITTEXT 
	        VALUENAME "Background"
		DEFAULT "0 78 152"
	    END PART
	END POLICY
 
END CATEGORY

 

How To Use

Adding the ADM

  1. Download the attached file or copy the above into notepad and save it as Custom Desktop.adm
  2. Create a new GPO or modify an existing GPO
  3. Exapnd User Configuration => Administrative Templates
  4. Right-click Administrative Templates and select Add\Remove Templates
  5. Click Add and Browse and add the ADM file then click close
  6. Under Configuration => Administrative Templates you should now see and aditional category called Custom Desktop

Disable showing of only fully managed policies

Do default policies that modify registry settings are not show in the console

  1. Select Administrative Templates
  2. Open View menu => Filtering
  3. Un-tick Only show policy settings that can be fully managed and click ok

Setting a Wallpaper

  1. In your GPO expand User Configuration => Administrative Templates => Custom Desktop
  2. Double click on the Desktop Wallpaper policy
  3. Select the Enabled radio button
  4. Set the Wallpaper Path to the location where the client will be able to find the wallpaper, the wallpaper must be a .bmp file
  5. Set the Wallpaper Style to the required setting Stretched, Centered or Tiled
  6. Click Ok

Setting a Desktop Background Colour

  1. In your GPO expand User Configuration => Administrative Templates => Custom Desktop
  2. Double click on the Desktop Background Color policy
  3. Select the Enabled radio button
  4. Enter the desired  Red Blue Green value for the desktop colour in the format R{space}B{space}G for example a all Red background  would be 255 0 0 and white would be 255 255 255
  5. Click Ok

Please note that the Desktop Desktop Color is only used if "Use drop shadows for icon labels on the desktop" is unticked in System Properties => Performance Options

AttachmentSize
Custom Desktop.adm1.11 KB

Comments

imageblur's picture
up
0 users have voted.

can not import the file, I get errors

 

Error 51 Unexpected keyword

Found:From:
Expected: CLASS, CATEGORY, [strings]

The file can not be loaded

PhilEddies's picture
up
0 users have voted.

Sorry ro hear that, I will take a look

Guest's picture
up
0 users have voted.

Happened to me as well. If you are doing a copy & paste you need to hit return after the last line "End Category" and that will solve your problem.

Blunderguff's picture
up
0 users have voted.

 This happened to me at first. If you are using the cut & paste method you need to hit return after the last line "End Category" and then save. For some reason if you don't it cuts off the "y" in category on import even though it still shows it when you open the file.

PhilEddies's picture
up
0 users have voted.

Thanks for the comments, I have not tried it on Windows 7 as yet only on Windows XP.

I am unable to test untill next week I will let you know my results, has anyone else had a gone on Windows 7?

Thanks again for findinga fix to that problem, I will see if I can find a cause to the copy and paste issue.

Consultants for software's picture
up
0 users have voted.

My brother suggested I might like this website. He was entirely right.

This post truly made my day. You can not imagine just how much time I had
spent for this information! Thanks!

the dog's picture
up
0 users have voted.

works on Win7 as well?

wireless dog fence's picture
up
0 users have voted.

Thanks for the information. It will indeed be very useful to many.

csr's picture
up
0 users have voted.

HIm

 

Does this ADM file connect to file share and download the bmp every time that user log ? or will it cache on first time ?

 

regards

PhilEddies's picture
up
0 users have voted.

Hi, No the files will need to be local or you should be able to use a UNC path but the device would need to be on line.

You will need to use a login script or some sort of software deployment tool first to get the files down

csr's picture
up
0 users have voted.

I didnt use the software script to download the file. SO that mean its downloading from the server everytime that user loggin ?

 

Can you give me such a script ?

 

regards & Thanks

PhilEddies's picture
up
0 users have voted.

Hi,

If you used the adm to point to a file on a network share then the policy will only work will the computer is connected to the network if for example a laptop is offline when is logs on it will not get the wallpaper, no automatic download occurs.

If you are calling a batch file at logon you could simply use the copy command or take a look at the VBS script below. Don't forget to change your policy to point to the local file.

Set objFSO = CreateObject("Scripting.FileSystemObject")

wallpaerSourcePath = "\\sourceserver\sourceshare"
wallpaperDestinationPath = "C:\Wallpapers"
wallpaperFileName = "my_wallpaper.bmp"

'If the local C:\Wallpapers folder does not exist create it
if NOT objFSO.FolderExists(wallpaperDestinationPath) Then
        Set objCwworkFolder = objFSO.CreateFolder(wallpaperDestinationPath)
End if

'If the wallpaper is not already in the folder copy if down
If NOT objFSO.FileExists(wallpaperDestinationPath & "\" & wallpaperFileName) Then
        objFSO.CopyFile wallpaerSourcePath & "\" & wallpaperFileName, wallpaperDestinationPath & "\" & wallpaperFileName, TRUE

End if

If you have lots of different devices with different screen resolution you may find the wallpaper does not stretch well, so you could also use a script similar to the below to copy different wallpapers depending on the resolution of the device;

'---------------------------------------
'Get the computers screen Resolution
'---------------------------------------
array_ScreenRes = GetScreenResolution
screenRes_X = array_ScreenRes(0)
screenRes_Y = array_ScreenRes(1)

if screenRes_X = "1024" and screenRes_Y = "768" then
        'Exact Match 1024x768
        'Copy the file(s)
elseif screenRes_X = "1280" and screenRes_Y = "800" then
        'Exact Match 1280x800
        'Copy the file(s)
elseif screenRes_X / screenRes_Y = "1.6" Then
        'Aspect ratio is standard widscreen the 1280x800 should stretch well
        'Copy the file(s)
End if

'---------------------------------------
'FUNCTION:- GetScreenResolution
'---------------------------------------

Function GetScreenResolution()
        Set oIE = CreateObject("InternetExplorer.Application")
        With oIE
                .Navigate("about:blank")
                Do Until .readyState = 4: wscript.sleep 100: Loop
                        width = .document.ParentWindow.screen.width
                        height = .document.ParentWindow.screen.height
        End With

        oIE.Quit
        GetScreenResolution = array(width,height)
End Function

 

csr's picture
up
0 users have voted.

Hello,

 

Thanks for the script. i read your script, Bur apparently script is trying to copy file from the network share every time user logging. Can you change this to only copy file if not exists ?

 

regards & Thanks

Shameera

PhilEddies's picture
up
0 users have voted.

Hi Shamerra,

The top script is already set to only copy the file down if it is not already there.

csr's picture
up
0 users have voted.

HI

 

Thanks for the script buddy.. I'll test and let you know.

Wht is your name ?

 

regards

PhilEddies's picture
up
0 users have voted.

Ok, thanks

I am Phil

csr's picture
up
0 users have voted.

Hello dude,

Now everything is working fine, But there is huge problem with this.

1) Client Computers can change their wallpaper( Right click on picture and click on Set as Desktop Wallpaper)

2) When wallpaper copied to local disk, users change another image with same name, then again they change wallpaper.

 

anyway to prevent this ? can add something to script

Regards

PhilEddies's picture
up
0 users have voted.

Cool,

1) Client Computers can change their wallpaper( Right click on picture and click on Set as Desktop Wallpaper)

Due to the limitations of Windows this one is always a bit tricky, you can enable the GPO "Prevent Changing Wallpaper" but that will only stop the user using Display Properties to change the wallpaper it will not stop them using right-click, image preview etc.

Saying that what should happen is the next time group policy refreshes (about ever 15mins) it will change the reg key back forcing them to your chosen wallpaper. They may have to logoff and back on for it to take a effect.

2) When wallpaper copied to local disk, users change another image with same name, then again they change wallpaper.

Make sure the user only has read-only access to the file. You could use a GPO "Computer Configuration/Windows Settings/Security Settings/File System" or a script.

The problem you may face is when it comes time to change the wallpaper, the user will need write access to the file so you would need to temp change the gpo to give write access before deploying a new wallpaper.

I hope that helps

Maui's picture
up
0 users have voted.

Hi there,

I tried it under Windows 7 and it doesent work. Did you test it under 7??

Thanks for Help

PhilEddies's picture
up
0 users have voted.

Hi,

I am afraid I did not, this was only tested under Windows XP.

I have done a few quick searches and found Windows 7 has a "feature" , the reg key this GPO template modifies HKEY_CURRENT_USER\Control Panel\Desktop\WallPaper is missing on Windows 7.

It seems the fix should be to create a new String Value under Desktop called WallPaper, you don't need to set a value the above GPO will take care of that.

If you need to do this for a lot of computer then you could use a logon script to create this, or use a GPO (User Configuration => Preferences => Windows Settings => Registry)

Hope this helps?

Let us know ow you get on?

Guest's picture
up
0 users have voted.

Hi,

The fix creating a String under "WallPaper" in HKEY_CURRENT_USER\Control Panel\Desktop\ works for windows 7 and Windows Server 2008 R2.

Thanks.

PhilEddies's picture
up
0 users have voted.

Excellent, thanks for letting us know!

Guest's picture
up
0 users have voted.

Is it possible that after going through all these steps the background color overwrites the desktop background? I am testing this and finding that some machines just don't display the logo we have in the middle of the screen even after the color changes. If I drop the 'Desktop Background Color' then the 'Desktop WallPaper' displays fine. Any ideas?

Wiggz's picture
up
0 users have voted.
I know this post has been inactive for a while, but this is exactly what I needed for the configuration at my workplace. Everything works great except the "Style," it seems to only be "Center" regardless of my choice in the dropdown. Windows XP system. Any help would be greatly appreciated.
Dave's picture
up
0 users have voted.
Indeed the Style piece is not working. I noticed the same thing under Windows Server 2003.

SOLUTION
What you need to do is remove "NUMERIC" in the lines for "Centered", "Tiled" and "Stretched" and reload the ADM file.

Although the value for the style is a number, it is stored as a string in the registry (REG_SZ) and not an actual numeric/binary value (REG_DWORD). Removing "NUMERIC" will solve your problem.
PhilEddies's picture
up
0 users have voted.

Excellent, thanks for the post, I will give it a test and update the article

Brian's picture
up
0 users have voted.
Your color placement is off on your original template. It should be RGB rather than RBG. But thanks for the code!

Add new comment