Use a PowerShell Logon Script To Update Printer Mappings

Recently we migrated our Printserver from Windows 2003 R2 (yes, it was time…) to Windows 2012R2 and needed a smart and easy way to migrate existing printer mappings from the old to the new server. While migrating the printerserver itself was a very easy and straighforward task using Printbrm (took only about 10 mins!), the question how to migrate the mappings remained open. Doing some research on the net showed that it seemed to be best practice to do this using a logon script. A little bit of more searching brought up a very helpfull and handy PowerShell script which should to the trick. Since all our clients are at least Windows 7, PowerShell was available on clients and we were able to go on with this.

The script was good, but needed some minor tweaks to work well in our environment. For exmaple the script lacked to set the default printer. If you remove the old printer and add a new one you have to set the default printer again, this has been fixed in the version below.

It was also not possible to have 2 different names for the printserver so e.g. some users may have user FQDN ( and some only the simple Name (printserver). To catch all this cases you can now specify more than one name for a print server and all printers will be replaced.


To run the script, simple copy the source code to a file on your PC and change the following lines to your need.


If you want a quite handy logfile where you can see how your migration is making progress. Change the following line to a path where all users can write.


Remove <# and #> from the following lines and run the Script once, to create the logfile with a header line. After the file has been created, add <# and #> again to avoid overwriting the file each time the script is running.


Here you can find the complete source code:


Leave a Reply

Your email address will not be published. Required fields are marked *