Difference between revisions of "Printer configuration"
Line 96: | Line 96: | ||
More silent printer installation options [http://www.msfn.org/board/lofiversion/index.php/t43120.html here]. | More silent printer installation options [http://www.msfn.org/board/lofiversion/index.php/t43120.html here]. | ||
+ | = Another lazy way (Vista) = | ||
+ | For Vista, you can migrate your printers with printbrm. | ||
+ | |||
+ | - Open the Administrative Tools folder, and then click Print Management. | ||
+ | |||
+ | - In the Print Management tree, right-click the name of the computer that contains the printer queues that you want to export, and then click Export printers to a file. This starts the Printer Migration Wizard. | ||
+ | |||
+ | - On the Select the file location page, specify the location to save the printer settings, and then click Next to save the printers. For this example, it'll be "printer_labo.export". It contains a Brother HL-1470N printer. | ||
+ | |||
+ | The deployement after that is: | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <package | ||
+ | id="labo-printer" | ||
+ | name="Labo Printer" | ||
+ | revision="1" | ||
+ | priority="0" | ||
+ | reboot="false"> | ||
+ | |||
+ | <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\Brother HL-1470N\Name" value="Brother HL-1470N" /> | ||
+ | <install cmd="c:\windows\system32\spool\tools\printbrm.exe -r -f %SOFTWARE%\Printers\printer_labo.export -O FORCE" /> | ||
+ | <install cmd='rundll32 printui.dll,PrintUIEntry /y /n "Brother HL-1470N"' /> | ||
+ | </package> | ||
+ | </source> | ||
[[category:Silent Installers|Printer configuration]] | [[category:Silent Installers|Printer configuration]] | ||
[[Category: Changing Windows settings]] | [[Category: Changing Windows settings]] |
Revision as of 07:42, 16 January 2009
WPKG can be used for configuring printers and printer ports, too.
Adding TCP/IP printer ports
The following VBS script "addTcpipPort.vbs" adds a TCP/IP printer port, which can be then used by a printer installation:
Set args = WScript.Arguments
printerPortName = args.Item(0)
tcpipAddress = args.Item(1)
tcpipPortNumber = args.Item(2)
Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = printerPortName
objNewPort.Protocol = 1
objNewPort.HostAddress = tcpipAddress
objNewPort.PortNumber = tcpipPortNumber
objNewPort.SNMPEnabled = False
objNewPort.Put_
Syntax:
cscript addTcpipPort.vbs <new port name> <printer address> <printer port>
Usage example, add a new printer port named "printerport1" with IP address "192.168.1.2" and port number "9100":
cscript addTcpipPort.vbs printerport1 192.168.1.2 9100
Adding Printers
When a new printer is configured on a server, it still has to be "installed" on a workstation.
A simple way to do it is the usage of startup scripts: executed with Administrator or SYSTEM rights - to install a printer on a workstation, and, user logon scripts, to install a printer for a user.
First, install a printer on a server and make sure it prints.
If it prints, add a line like this to /home/samba/unattended/packages/wpkg/wpkg-start.bat
(the batch file where the WPKG is started):
rundll32 printui.dll,PrintUIEntry /q /y /ga /in /n \\servername\printername
with the appropriate servername and printername. Will set installed printer as default.
This has a drawback, that it'll be used by all machines and run with user permissions. If you are adding non-domain printer to workstation in domain, make sure that point and print restrictions are disabled.
To install a printer on certain workstations only, a WPKG entry like below could be used:
<packages>
<package id="printer" name="room 17" revision="1" priority="0" reboot="false">
<check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Print\Connections\,,servername,printername\Server" value="\\servername" />
<install cmd="rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printername" />
<install cmd="net stop spooler" />
<install cmd="net start spooler" />
<remove cmd="rundll32 printui.dll,PrintUIEntry /gd /n\\servername\printername" />
<remove cmd="net stop spooler" />
<remove cmd="net start spooler" />
<upgrade cmd="rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printername" />
<upgrade cmd="net stop spooler" />
<upgrade cmd="net start spooler" />
</package>
</packages>
The lazy way
... or you could use printmig (pre-vista only) ... All you need to do is install the printers on one machine and export them from printmig... You will get a nice cab file this way...
<packages>
<package
id="printer"
name="printer"
revision="0"
reboot="postponed"
priority="5"
execute="once">
<install cmd="%SOFTWARE%\printer\printmig.exe -i -r %SOFTWARE%\printer\printer.cab" />
</package>
</packages>
More silent printer installation options here.
Another lazy way (Vista)
For Vista, you can migrate your printers with printbrm.
- Open the Administrative Tools folder, and then click Print Management.
- In the Print Management tree, right-click the name of the computer that contains the printer queues that you want to export, and then click Export printers to a file. This starts the Printer Migration Wizard.
- On the Select the file location page, specify the location to save the printer settings, and then click Next to save the printers. For this example, it'll be "printer_labo.export". It contains a Brother HL-1470N printer.
The deployement after that is:
<package
id="labo-printer"
name="Labo Printer"
revision="1"
priority="0"
reboot="false">
<check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\Brother HL-1470N\Name" value="Brother HL-1470N" />
<install cmd="c:\windows\system32\spool\tools\printbrm.exe -r -f %SOFTWARE%\Printers\printer_labo.export -O FORCE" />
<install cmd='rundll32 printui.dll,PrintUIEntry /y /n "Brother HL-1470N"' />
</package>