Difference between revisions of "Printer configuration"
(Adding TCP/IP printer ports) |
(Updated WPKG entry with check, uninstall, upgrade sections) |
||
Line 44: | Line 44: | ||
<source lang="dos"> | <source lang="dos"> | ||
− | rundll32 printui.dll,PrintUIEntry /q /y /ga /in /n \\ | + | rundll32 printui.dll,PrintUIEntry /q /y /ga /in /n \\servername\printername |
</source> | </source> | ||
− | with the appropriate servername and 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. | + | 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 [http://support.microsoft.com/kb/319939 restrictions] are disabled. |
To install a printer on certain workstations only, a WPKG entry like below could be used: | To install a printer on certain workstations only, a WPKG entry like below could be used: | ||
<source lang="xml"> | <source lang="xml"> | ||
− | < | + | <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" /> | |
− | </package> | + | <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> | ||
</source> | </source> | ||
− | + | More silent printer installation options [http://www.msfn.org/board/lofiversion/index.php/t43120.html here]. | |
− | + | ||
− | + | ||
− | |||
[[category:Silent Installers|Printer configuration]] | [[category:Silent Installers|Printer configuration]] | ||
[[Category: Changing Windows settings]] | [[Category: Changing Windows settings]] |
Revision as of 14:42, 28 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>
More silent printer installation options here.