Please consider donating: https://www.corelan.be/index.php/donate/


24,385 views

Backup & Restore Windows Server based Print Servers

After having to recover a broken Windows Server based print server yesterday, I decided to write this small article on how to set up print server backups, and describe the simple process of recovering the print server after a crash (or even roll back printer drivers in case a newly installed driver messes up your print server).

Backing up Windows 2000 / 2003 Print Server settings

Let’s assume you have one or more Windows server that hosts some or all of your network printers, so end users can connect & use these shared printers.  Each of these printers were probably added manually, a lot of drivers have been installed and configured manually, printers have been shared manually.   If this server breaks down, you would have to redo all of this work, unless you have a good backup of these printers. In order to make a solid backup, you can use a small free utility from Microsoft, called printmig.exe. This utility will backup the printers, printer settings, share definitions, and drivers. Put this exe file on your 2000 or 2003 server (let’s say in c:\scripts). Create a folder that will hold the backup of the printers (for example d:\printerbackup, and create a small batch file that runs the following task :

del d:\printerbackup\printers.cab.5 ren d:\printerbackup\printers.cab.4 d:\printerbackup\printers.cab.5 ren d:\printerbackup\printers.cab.3 d:\printerbackup\printers.cab.4 ren d:\printerbackup\printers.cab.2 d:\printerbackup\printers.cab.3 ren d:\printerbackup\printers.cab.1 d:\printerbackup\printers.cab.2 ren d:\printerbackup\printers.cab d:\printerbackup\printers.cab.1 c:\scripts\printmig -b d:\printerbackup\printers.cab -i

Create a scheduled task which runs this batch file on a regular basis, and then make sure you copy the printers.cab* files to another location (a tape or another remote server) so you can get access to this file again when the server dies. You can use the same script to backup the printers before you install a new driver. If the installation goes wrong, you can use the restore procedure (see further down in this document) to roll back the changes. Note : the printmig utility cannot backup 64bit drivers.

Backing up Windows 2008 Print Server Settings

The printmig.exe utility does not work under Windows 2008, but there is another (similar) tool that can be used to backup the printers via a script.  This tool is not available on the server by default, it only gets installed when you install the “Print Services Tools” Feature. image Create a folder to hold the backups (“d:\printerbackup”), and use the following script to perform the actual backups :

del d:\printerbackup\printers.printerExport.5 ren d:\printerbackup\printers.printerExport.4 d:\printerbackup\printers.printerExport.5 ren d:\printerbackup\printers.printerExport.3 d:\printerbackup\printers.printerExport.4 ren d:\printerbackup\printers.printerExport.2 d:\printerbackup\printers.printerExport.2 ren d:\printerbackup\printers.printerExport.1 d:\printerbackup\printers.printerExport.1 ren d:\printerbackup\printers.printerExport d:\printerbackup\printers.printerExport.1 %WINDIR%\System32\Spool\Tools\printbrm -B -O FORCE -F d:\printerbackup\printers.printerExport

Schedule this script to run on a regular basis (or just use it to backup the settings before you install a new driver). Again, make sure you have a copy of these .printerExport* files on another server (or tape drive) to make sure you can recover in case of major server failure. The printbrm.exe utility will backup & restore 64bit drivers, and will work on Vista and Windows 7 as well.

Restoring Windows 2000 / 2003 Print Server Settings

Backing up the printers was easy, and restoring is easy as well. Just keep in mind that, for maximum success, you should restore the printers on a server that runs the same operating system as the original print server.   If you want to do a restore on the same server, you don’t need to remove the existing printers first.  Just run the restore procedure, restart the print spooler service, and you’re done. Restore procedure : Interactive restore : run printmig.exe. The GUI will open. Go to Actions – Restore and select the printers.cab file that contains the settings that need to be restored. Wait until the process completes, restart the print spooler (and tcp/ip printing) service, and you should be fine. image Scripted restore (will restore to the local machine)

printmig -r d:\printerbackup\printers.cab

(or, if you want to restore to a remote server, simply specify \\ at the end of the command. If you want to suppress warning popups, you can use -i parameter as well.

Restoring Windows 2008 Print Server Settings

Interactive restore : Open the “Print Management” mmc snap-in, go to “Print Servers”, select the print server that needs to be restored, right-click and choose “Import printers from a file”. Navigate to the backup file (printers.printerExport*) and load the file. image Again, the restore will only work fine if you are restoring onto a system that has the same processor type (32bit/64bit)/OS version as the original source server. Scripted restore :

%WINDIR%\System32\Spool\Tools\printbrm.exe -O FORCE -R d:\printerbackup\printers.printerExport

If you want to restore to a remote server, add the -S parameter, followed by the servername.

Final words :

Does the printmig/printbrm utility work all the time, for all types of printer drivers ?  No.  But it will most likely allow you to restore 99% of all printers onto a new system, so you would only have to deal with just a few printers/drivers after restoring. If you restore on the same machine (in case of a rollback), it should work 100% of the time.

© 2009 – 2021, Peter Van Eeckhoutte (corelanc0d3r). All rights reserved.

One Response to Backup & Restore Windows Server based Print Servers

Corelan Training

We have been teaching our win32 exploit dev classes at various security cons and private companies & organizations since 2011

Check out our schedules page here and sign up for one of our classes now!

Donate

Want to support the Corelan Team community ? Click here to go to our donations page.

Want to donate BTC to Corelan Team?



Your donation will help funding server hosting.

Corelan Team Merchandise

You can support Corelan Team by donating or purchasing items from the official Corelan Team merchandising store.

Protected by Copyscape Web Plagiarism Tool

Corelan on Slack

You can chat with us and our friends on our Slack workspace:

  • Go to our facebook page
  • Browse through the posts and find the invite to Slack
  • Use the invite to access our Slack workspace
  • Categories