Using Group Policy Preferences to control multiple BGinfo scripts

I wanted to apply a different BGinfo-scripted background image as the wallpaper depending on what system a user was logging into, all using a single Group Policy.

This means that all servers are set to have a uniform background colour, but users on regular PCs are still be able to use any custom wallpaper on other computers without having to re-set it after each login.

While it is probably possible to create long-winded batch scripts to do what I wanted, it’s a lot easier to use the Group Policy Preferences (GPP) file options to control which BGinfo script is given to which systems.

One thing worth noting about GPP file control: I found that you have to use the “Replace” action rather than “Update” in Group Policy Preferences, as the targeted systems only update file attributes when using the “Update” action.

Step 1: BGinfo Scripts

  • Create the BGinfo scripts, and then put them in a network share that any authenticated user can access.
  • The BGinfo.exe file will also need to be in this share.

BGinfo Setup

Step 2: Group Policy Preferences

  • Create Group Policy User Preference entries for your .bgi files and BGinfo.exe
  • Optionally: apply item-level targeting if you want to limit which systems this preference applies to
    • I organise my systems into OUs (Organisational Units), but it’s easy to target specific Operating Systems if you prefer

Group Policy Management Editor - Editing User File Preferences

Step 3: Logon Script

Finally, create the logon script to create the BGinfo background image every time a user logs in:

Group Policy Management Editor - User Logon Scripts

Click the “Show Files…” button and create a new batch file in the folder that opened in Explorer (e.g. bginfo.bat). Then open the batch file in your favourite text editor and paste the following line into it. (Modify the paths and filenames as required.)

IF EXIST C:\bginfo\yourfile.bgi c:\bginfo\bginfo.exe c:\bginfo\yourfile.bgi /timer:0 /silent /nolicprompt

Then close the text editor and Explorer window, click the “Add…” button, and select the batch file you just created.

The End Results:

BGinfo Result for a Server

BGinfo Result for a Desktop

Comments are closed.