How to migrate local ports when doing print migration
Hello Askperf! My name is Tingu, and today I’m going to talk about an interesting print migration issue I had a few weeks ago.
We had a case where an application server was running on Windows 2003, where more than 400 print queues were created. The port was created as a local port to forward the print job in case of a failure as noted in the “Transfer documents to another printer” Technet article.
The port was configured as \\printservername\printer. See example screenshot below:
Here, we were trying to move the application to a 2012 R2 server and wanted to migrate all the print queues to the new server. We used printbrmto migrate all of the local printers. But the problem we ran into is that it did not migrate the local ports.
When we started the migration, we did not see the local ports listed:
Additionally after the migration, the port was not present:
We tried to add the port manually, but gave us the error “port already exists”. Additionally, the registry shows that the printer is set to use the forwarder.
We really needed to get the local ports migrated as it can be a tedious task to re-create all the ports and map to their respective print queue.
We created a test lab and saw the same issue while migrating. It did not matter from/which OS we were migrating. During the migration, we saw an event ID 81 on the 2012 R2 server. (This event is not triggered if you are migrating to 2003 or 2008R2):
Log Name: Microsoft-Windows-PrintBRM/Admin
Source: Microsoft-Windows-PrintBRM
Date: 12/25/2014
Event ID: 81
Task Category: Restore
Level: Error
Keywords: Print Queue
User: Joe
Computer: 12345
Description:
Printbrm.exe (the Printer Migration Wizard or the command-line tool) failed to restore print queue test. The restore process will continue, skipping this queue. Error: 0x80070057 which is “invalid parameter”
Error: 0x80070057 which is pointing to “invalid parameter”
So what we determined is that when you use printbrm for migration, it will not migrate the local ports. The reason is that the local port is specific to the server, and it may cause conflicts or not work if you migrate it to a different server. But in our case it’s a forwarder, and we need it to be migrated.
Further testing revealed that if a local port to which the printer is mapped is already present on the destination server, then the migrated printers will use that local port for the printers.
For example: on the source server you have a printer mapped to LPT1, and the destination server has LPT1 port available; then after the migration, the printer will be set to use that port. We created a forwarder on the destination server for a test printer before migration, and after importing the printer, we see that the port is mapped accordingly.
Now the question is, how do we migrate multiple local ports at a time?
Here is what we did…
From the print management on a 2012 R2 server, we added the 2003 server. Then we exported the list of ports to a .csv file:
This gave us the list of all ports needing to be migrated. We then created a script to add the ports to the destination server. As in our case, the destination server was Windows 2012 R2 server, so we used the powershell command Add-PrinterPort.
We copied all of the required ports into notepad, and saved it as a .ps1 file:
We ran the .ps1 file as admin, and all of the ports got created on the destination server!
Note If you have already tried the migration before creating the ports on the destination server, it may give you the error ‘port already exists’ while running the powershell command. You may need to delete the printers migrated and restart the spooler and then retry the powershell command to complete the port creation.
After that, we followed the normal migration procedureand all printers got mapped to the correct port.
I hope this information will come in handy the next time you are working through a printer migration.
-Tingu
Comments
- Anonymous
January 07, 2015
Hello Askperf! My name is Tingu, and today I’m going to talk about an interesting print migration