How to use Group Policy Preferences to dynamically map printers with Roaming Profiles

One of the great new feature with Group Policy Preferences is the ability to map printers based on a various number of criteria such as group membership, AD Site or even IP Address range to name a few. This allows for some powerful senarios such as being able to map all the printers physically near a user based on the computers IP address. Note: This assumes that the networking team allocates the same subnets to certain computers near each other (e.g. a building or floor) but I have found this is often the case.

One of the problems that occur when you map printers with Group Policy Preferences is that if the user has a roaming profile configured and they then logon to a computer that is located in another area they will have all also have their old printers from the previous area. Now user might not really notice these printer mapping building up over time but they can soon amass a large number of mappings that makes their computer run slow to logon.

Question? So how do you map all the printers in one location but not have them follow you to another location if you are using a roaming profile?

Answer? Is a two step solution which I will go through below. There is also an optional third step that address the problem maintaining default printer mappings once a user gets back to their normal location.

Step 1. The first part is just to create a simple printer mapping that maps the printer targeted by the IP address of the users current computer.


Figure1. Create New Shared Printer

The images belo shows the printer “\\server\printer1” being mapped for the users that logon to a computer that is in the subnet. It is important to note that we are talking about the IP address range of the computer that you want to map the printer not the IP address range of the printer server or the printer NIC itself.


Figure 2. Target setting to only be mapped for computers between to


Figure 3. Resulting printer mapping

Step 2. The second step is to delete the printer mapping if the IP address of the printer does not fall within the IP address range that you want the printer to be mapped. To do this we start by copying the existing printer mapping that we made in step 1. This avoids making any typo’s in either the printer queue name of the IP addresses.


Figure 4. Copying the existing printer mapping made in step 1.


Figure 5. Paste the setting into an unused part of the pane


Figure 6. Both printer mapping entries

Now we make the changes to the action on the second printer mapping targeting so that it will remove the printer mapping when the user logs onto a computer in another area.


Figure 7. Open the properties of the second printer


Figure 8. Change the Action to “Delete”


Figure 9. Go back to the targeting and change it to an “Is Not” between “” and “”


Figure 10. New target rule


Figure 11. Two printer entries to map and then clean up the printer queues for a user based on their location.

Step 3. Maintaining Default Printer Mappings

You have now configured dynamic printer mapping for your user based on location of the user. However this solution does have one problem/annoyance, user normally like to set a default printer. If a user was to logon to a workstation in another location then return to their normal desk their default printer will have been reset as it will have been removed. To get around this problem we have to add another rult to the targeting on the Delete printer option so it does NOT delete if the printer is configured as the default printer. To do this we check the registry location that the default printer is saved and test to see if the printer we are deleting is the default printer.

So go back to the targeting option for the Delete printer action and add another test that will check to see if the printer is the default printer.


Figure 12. Add a new Item of type “Registry Match”


Figure 13. Configured Registry Match Setting

Change the Match Type to “Match value data” and the Value data match type to “Substring match” as the value we are looking for will contain other information as well that we don’t care about. Make sure the Hive is set to “HKEY_CURRENT_USER” and the Key Path is set to “Software\Microsoft\Windows NT\CurrentVersion\Windows”. The Value name “Device” is where in the registry the default printer information is saved. We then set the Substring to “\\server\printer1” which is the UNC path to the printer queue. Note: The substring value has to be exactly the same as the value set in the Path for the printer mapping.

There, now you know how to use Group Policy Preferences to map and remove network for users based on their physical location while avoiding the build up of mapping if your user have roaming profiles while still preserving their default printer.

Author: Alan Burchill

Microsoft MVP (Group Policy)

21 thoughts on “How to use Group Policy Preferences to dynamically map printers with Roaming Profiles

  1. After testing the group policy preference File/Create option I can tell you that it does create the source folder and put the copied file(s) in it, (even if it doesn´t exist on the targeted client). It will even create folder trees.

  2. I found this article important to me but all the figures have been dislocated or mis-indexed so they are blank. Please direct me to a page I can see all the figures. Thanks.

  3. Great Article. I am following the method described but that default printer is not sticking no matter what. i log in, the printers map (preference set to update) log out, log in and the default printer has defaulted to the XPS writer.

    happens if i set to create as well. Any Ideas?


    1. Hi Peter,

      It would seem that you need to add the correct registry please refer back to figure 13. You need to change the default entry from XPS writer to the printer you want.

      PS READ FIGURE 13 carefully.

  4. I hope, someone is still monitoring this thread: The problem with the delete options is that it is processed before the roaming profile printers are loaded. So it only works if you run a gpupdate after the user has been logged on. Anyone else having this problem?

  5. How can I get this to work in RDS? How can you program the IP level targeting to map the printers according to the IP address of the Thin Client, NOT the IP address of the RDS server?

    1. There is an option within the Item Level Targetting. When you click on the new item, there is an option to target Termial Sessions, and there is a Client ITC/IP address perameter in there.

  6. Alan;

    Just for clarifications sake, if I wanted to run this set up in our GPO architecture, then the GPP would need to be applied to the COMPUTER’s in our ADUC, correct? As in, I couldn’t run a Targetting Filter for IP address exclusion against a user’s OU and have it work properly… right?


  7. Pingback: North Bay

Leave a Reply