This is a copy of a post which was on Ask MetaFilter, August 2, 2006.
In a Windows Server 2003 domain environment, is there a way to push printers to client machines if they are not shared printers? What about changing printer settings over the network?
I often need to setup networks of about 40 machines with 4 IP printers. They are all identical printers but with different IP addresses. I split them up in groups of 10, with each group printing to one of the printers. I would like to automatically push the printers to client machines.
My first thought was to create a share on the network, ie \\server1\Printers, and then create a login script that installs the printer. The problem with that is, it will attempt to install the printer every time the users log on unless I get rid of the script after the first login, which seems like it’d be counter-intuitive.
The other problem with this is that I need specific printer settings… paper size is Envelope Comm #10, landscape, paper source is Tray 1 (Manual Feed). Even if I could push an installation of the printer with a script, how would I push down these settings?
For my script to install the printer, I had something like this:
start /wait rundll32 printui.dll,PrintUIEntry /if /b "printer_name" /f \\server1\Printers\4350\hpc4x50b.inf /r "IP_192.168.0.252" /m "HP LaserJet 4250 PCL 5e" /z
I’ve read that with Windows Server 2003 R2 there is a new print management tool but I’ve also heard it’s only for network/shared printers.
(Client machines are XP Pro)
posted by Ekim Neems to computers & internet (2 answers total)
The printer share with mount on login (through login script) is the only real way to do this. You can map directly to the IP, but it doesn’t download the drivers to the workstation, configure the default settings of the printer, or allow you to manage who has access through permissions (which is what you’re doing when you mount the share on the workstation).
That is how print admins manage all those complex driver settings for individual users, manage permissions on the printers, and update/downgrade drivers when there are issues.
If you’re still worried about installing the printers every time, through VBScript (or more specifically, WSH) you can enumerate the printers on the workstation and then determine if you want to install the printers. Here’s some sample script:
' Declare variables.
Dim intInstallPrinterFlag, strPrinterName, WshNetwork, clPrinters
' This flag will determine if you want to remove the installed printer first (updated drivers, new settings etc.)
intInstallPrinterFlag = 0
' First argument to the script. Should be in the format \\SERVERNAME\PRINTERSHARENAME strPrinterName = WScript.Arguments.Item(0)
' Declare the WSH object to handle network printer connections.
Set WshNetwork = Script.CreateObject("WScript.Network")
' Enumerate all the printers on the local workstation.
Set clPrinters = WshNetwork.EnumPrinterConnections
' Install the printer, there are none on the workstation.
If clPrinters.Count <> 0 Then
' Now, if there is a printer installed and the install printer flag is set, then remove the existing printer and re-install it.
ElseIf clPrinters.Count > 0 And intInstallPrinterFlag = 1 Then
Save the above in a .vbs file and add to the login script for a user.
This can obviously be built upon (for instance, the duplicate AddWindowsPrinterConnection calls could be wrapped up into a function or sub to prevent duplication.
Extra logic could be added to handle multiple printers on the workstations and how to assign the default printer etc.
If there are any bugs in the script I apologize. I wrote it quickly and from memory. You can find a lot of information about WSH at devguru.
posted by purephase at 12:03 PM on August 2, 2006
As for doing the settings: Open the printer’s Properties sheet, click the Advanced tab, then click the Printing Defaults button. This brings up a window that looks exactly like the usual Printing Preferences window except that the window title is "blah blah Printing Defaults" instead of "blah blah Printing Preferences". Any settings you make here will become the defaults for any new installation of or connection to that printer.
posted by flabdablet at 9:09 PM on August 2, 2006