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

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

17 thoughts on “Group Policy ADM to set the desktop wallpaper and the desktop colour”

  1. can not import the file, I get errors

     

    Error 51 Unexpected keyword

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

    The file can not be loaded

    Reply
  2. 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

    Reply
  3. 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

    Reply
  4. 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

    Reply
  5. 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 1024×768
            'Copy the file(s)
    elseif screenRes_X = "1280" and screenRes_Y = "800" then
            'Exact Match 1280×800
            'Copy the file(s)
    elseif screenRes_X / screenRes_Y = "1.6" Then
            'Aspect ratio is standard widscreen the 1280×800 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

     

    Reply
  6. 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

    Reply
  7. 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

    Reply
  8. 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

    Reply
  9. 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?

    Reply
  10. 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?

    Reply
  11. 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.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.