Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating install of a tcp/ip printer 3

Status
Not open for further replies.

secutanudu

IS-IT--Management
Oct 6, 2004
138
US
Is there any way to automate (with scripts, a batch file or otherwise) the install of a printer on a new tcp/ip port?
 
I just realized that I never even posted the script i was trying to run in my last posting. I am still trying to get my VBS script to install a TCP/IP printer whose drivers are not in the native XP install.

Here's what I am running - nothing "appears" to happen when i run it, but I get no error. Your last post mentioned that I need to define a port, which i realize I didn't do - but i dont even know where i should put that. I tried doing a objDriver.PortName but it didn't like that.

Any ideas? Thanks.




Set WSHNetwork = WScript.CreateObject("WScript.Network")
set shell = WScript.CreateObject( "WScript.Shell" )
CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True

Set objDriver = objWMIService.Get("Win32_PrinterDriver")

objDriver.Name = "HP 4050 CEH"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
objDriverPath = "u:\instalxp\hp4050\hpbf002g.dll"
objInfname = "u:\instalxp\hp4050\hpbf002i.inf"
intResult = objDriver.AddPrinterDriver(objDriver)
 
The objDriver.Name value *must* exactly match the name shown in the .inf file.
 
What value in the INF file should I be using as objDriver.Name.
 
Here is the INF file I am using in this example:

; HP LaserJet 4050 Series driver - 2K
; HP LaserJet 4050 Series driver installation file for MS Windows 2000
; Copyright © Copyright Hewlett-Packard 1996, 1997, 1998, 1999, 2000, 2001
; All Rights Reserved.

; Version section
[Version]
Signature="$Windows NT$"
Provider=HP
layoutfile=hpbf002i.inf
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer
catalogfile=hp002ep6.cat
driverver=09/19/2003,4.27.4050.410


; Manufacturer section
[Manufacturer]
HP=HPLaserPrinter

; Model sections.
[HPLaserPrinter]
%Printer%=hpbf002i.pmd,DOT4PRT\Hewlett-PackardHP_LABB4E&PRINT_HPZ,LPTENUM\Hewlett-PackardHP_LABB4E,HP_LaserJet_4050_PCL6

; Installer Sections
[hpbf002i.pmd]
CopyFiles=hpbf002e_FILES,LANGMON_FILES
DataSection=hpbf002e_DATA
DataFile=hpbf002i.pmd

; Data Sections
[hpbf002e_DATA]
DriverFile=hpbf002g.dll
ConfigFile=hpbf002e.dll
HelpFile=hpbf002e.hlp
LanguageMonitor=%HP_LANG_MONITOR%

; Copy Sections
[hpbf002e_FILES]
hpbf002e.dll
hpbf002g.dll
hpbf002i.pmd
hpbf002e.hlp
hpbafd32.dll
hpbftm32.dll

[LANGMON_FILES]
hpdcmon.dll


[DestinationDirs]
hpbf002e_FILES=66000
LANGMON_FILES=66000
DefaultDestDir=66000

; Localizable Strings
[Strings]
Printer="HP LaserJet 4050 Series PCL 6"
DiskID1="HP LaserJet 4050 Series PCL 6 Printer Driver Disk"
HP_LANG_MONITOR="HP LaserJet 5 Language Monitor,hpdcmon.dll"


; Sourcedisks section
[SourceDisksNames.x86]
1=%DiskID1%,,,""

[SourceDisksFiles.x86]
hpbf002e.dll=1
hpbf002g.dll=1
hpbf002i.pmd=1
hpbf002e.hlp=1
hpdcmon.dll=1
hpbafd32.dll=1
hpbftm32.dll=1
 
What should this script be doing? Should it be adding a printer, or just adding the driver to the driver list (so it is available in the list of printers when i install a new one)?

I tried doing the HP LaserJet 9000 instead (since it is not in the printer list) and used the name listed in the inf for objDriver.Name. When I run the script, no printer gets installed, and the HP 9000 is still not listed in the printer list. Any ideas?
 
I have sometimes had problems with drivers with vbs that are not in the driver.cab. This site is a must-have for printer installations. The RUNDLL32 command is very powerful.


This command should install the printer per your examples.

RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b "HP LaserJet 4050" /f u:\instalxp\hp4050\hpbf002i.inf /r "IP_IPPORTADDRESS" /m "HP LaserJet 4050
 
I went back and looked at bcastner's post above(he's always got excellent information). He has a link to a previous thread that discusses this method. When I catch it, I give credit where credit is due.
 
Oh did he? I must have missed that. This thread has gotten so long! Thanks bcastner!
 
I have learned that when he posts information, it's a good bet it's going to be extremely helpful. :)
 
I have learned that too. I've only been a tek-tips member a couple of months and have already got lots of help from him.

Thanks to you as well....
 
One more question - and i did ask earlier - bcastner replied but i think i may have worded my question incorrectly, so I am not sure what he wrote will be exactly what I need.

Our printers have a few different options that we need to set once they are installed (duplexer installed, trays installed, amount of RAM...). Is there any way to have these options pre-selected so that once they are installed they will have the correct options set? Some HP Printers seem to automatically talk back to the workstations to tell it what it has installed, some don't...
 
I have never needed to do that. It looks like you might be able to use the /Ss command to store the settings from a machine that you have configured manually and use /Sr to restore it to another machine. It's worth a try.....
 
i'll give that a shot. I wonder what settings it is storing...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top