Distributing an IP-based Printer with an App Object
Novell Cool Solutions: Tip
By Arnoud Kesselaar
Reader Rating
from 3 ratings
|
Digg This -
Slashdot This
Posted: 5 Jul 2007 |
ENVIRONMENT:
ZENworks 4 , Microsoft Windows Xp SP2, users are by means of DLU power user in XP
PROBLEM: We have a ZENworks 4 environment and we want to distribute an IP-based printer with an application object. In the past this was done with a simple snapshot of the printer driver installation. The problem we had was that the spooler services must be restarted before it would work, and this was done by an "ugly" DOS screen with a net stop spooler and net start spooler.
SOLUTION: To overcome this problem we used vbscript and the rundll32.exe to create the network port and the printer.
EXAMPLE:
We created a Distribution script which creates the network port.
The script engine we have set to c:\windows\system32\wscript.exe and the extension is .vbs
[Start Run before distribution script]
strcomputer = "."
set oshell = WScript.CreateObject("Wscript.shell")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
objwMIService.Security_.Privileges. _
AddAsString "SeLoadDriverPrivilege", True
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "%IPadress%"
objNewPort.Protocol = 1
objNewPort.HostAddress = "%IPadress%"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
[End Run before distribution script]
In the run options we set the path to file
C:\WINDOWS\system32\rundll32.exe
and the parameters
PRINTUI.DLL,PrintUIEntry /if /b "%PrinterName%" /f "\\aotserver\VOL1\AOT\xp\printers\HP LJ M4345 MFP\drivers\hpcm434b.inf"
/r "%IPadress%" /m "HP LaserJet M4345 MFP PCL 5"
At last create two Common/Macros
IPadress = ip address of the printer
PrinterName = The name of the printer object
Run this application as a secure system user and give the workstation object rf rights on the driver installation directory.
Reader Comments
- Check another solution here: http://www.novell.com/coolsolutions/trench/3515.html
- Nice solution. The Microsoft way is documented in "How to add printers with no user interaction in Windows", MS KB Article ID : 189105. http://support.microsoft.com/?kbid=189105
- Awesome! I had a devil of a time and never got it to work correctly. I made some minor modifications so that I could reuse (copy) the application more easily. I made all the settings macros (such as file location and the printe rmodel number). This allowed me to copy the printer application and just change the macros and the application name and I was ready to deploy a second printer. I also used the article above to push a second application with the printer settings. And went one step further with the stuff I found on http://www.robvanderwoude.com/2kprintcontrol.html to create a third that would delete the old printer that was no longer available. The command line Parameters I used looked like this: printui.dll,PrintUIEntry /dl /n "%PrinterName%" As long as you get the printer name correct, it works like a charm.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com
