Novell Home

Distributing an IP-based Printer with an App Object

Novell Cool Solutions: Tip
By Arnoud Kesselaar

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.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell