views:

29

answers:

1

We're migrating a bunch of printers from server 2003 to server 2008. This involves building new server 2008 boxes and decommissioning the older 2003 ones. There are alot of servers and a lot of printers. Are there ways to write a vb script or maybe a .net app to copy network printers from one server to another?

A: 

It you have an interest for a software solution you can use EnumPrinterDrivers to enumerate a printer drivers EnumPrinters to enumerate printers and EnumPrinterDataEx to enumerate a printer settings.

You can also use PrintUIEntryW function from the printui.dll. The function has prototype

HRESULT WINAPI PrintUIEntryW(HWND hwnd, HINSTANCE hInst, PWSTR pszParams, INT nShow);

(see http://support.microsoft.com/kb/189105 and http://support.microsoft.com/kb/314486). The parameter with parameters like "/ii /f C:\WINDOWS\inf\ntprint.inf" for example can be used to install a printer and some other operations.

You can use SetPrinter with level 2 to set printer settings.

If you are searching for some helpful VB-scripts you will find there in the directory %SystemRoot%\System32\Printing_Admin_Scripts\en-US.

Oleg