Difference between revisions of "Printer configuration"
(Updated WPKG entry with check, uninstall, upgrade sections) |
(printmig) |
||
Line 69: | Line 69: | ||
</packages> | </packages> | ||
</source> | </source> | ||
+ | |||
+ | = The lazy way = | ||
+ | |||
+ | ... or you could use printmig ... | ||
+ | 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... | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <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> | ||
+ | </source> | ||
+ | |||
+ | |||
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]. |
Revision as of 13:17, 29 November 2008
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 ... 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.