Allen and Glen,

Thanks for the replys. Allen, I assumed that the -2 was coming because of the previous error that it couldn't find the file specified, not the printertype. But frankly, I'm a little confused as to what to put for printertype. I'm unfamiliar with how these INFs are setup and I don't see an obvious "description" in the file. Here is an excerpt from the INF, can you tell what I should use as the printertype?

Quote:


;
; hp color LaserJet 2500 PCL 6 driver installation file for MS Windows 2000
; Copyright © Copyright Hewlett-Packard 1996, 1997, 1998, 1999, 2000
; Copyright © OAK Technology, INC. 1998-2000
; All Rights Reserved
;

; Version section
[Version]
Signature="$Windows NT$"
Provider=HP
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer
CatalogFile=HP2500P6.CAT
DriverVer=05/12/2003,4.20.2500.430

; Manufacturer section
[Manufacturer]
"HP" =HPLaserPrinter,NTx86.5.1.0x03,NTx86.5.1

; Model sections.
[HPLaserPrinter.NTx86.5.1.0x03]
;For Windows Server 2003
%Printer1%=HPBF342I.PMD,USBPRINT\Hewlett-Packardhp_co8E3D,LPTENUM\hewlett-packardhp_co8e3d,DOT4PRT\hewlett-packardhp_co8e3d,DOT4PRT\vid_03f0&pid_0717&rev_0400,hewlett-packardhp_co8e3d

[HPLaserPrinter.NTx86.5.1]
;For WinXP
%Printer1%=HPBF342I.PMD,USBPRINT\Hewlett-Packardhp_co8E3D,LPTENUM\hewlett-packardhp_co8e3d,DOT4PRT\hewlett-packardhp_co8e3d,DOT4PRT\vid_03f0&pid_0717&rev_0400,hewlett-packardhp_co8e3d

[HPLaserPrinter]
;For Win2k
%Printer1%=HPBF342I.PMD,DOT4PRT\Hewlett-Packardhp_co8E3D&BPRINT
%Printer1%=HPBF342I.PMD,DOT4PRT\Vid_03f0&Pid_0717&DOT4&BPRINT,hewlett-packardhp_co8e3d

; Installer Sections
[HPBF342I.PMD]
; To Disable Add Printer Auto Configuration: Remove "AUTOCFG_FILES" from the CopyFiles line below
DataSection=HPBF342I_DATA
CopyFiles=AUTOCFG_FILES,HPBF342I_FILES,LANGMON_FILES,LANGMON_DRVCOPY
DataFile=HPBF342I.PMD

; Data Sections
[HPBF342I_DATA]
DriverFile=HPBF342G.DLL
ConfigFile=HPBF342E.DLL
HelpFile=HPBF342E.HLP
LanguageMonitor=%HPDC_MONITOR%





Glenn, I originally had the file on a network share, but copied the filed over to my c:\ drive for testing. The errors are coming when I run the script manually from my computer.

To further get a handle on what's happening I decided to comment out the script to only leave the followng;

Code:

if NOT @LOGONMODE
Break On
EndIf
Dim $Mapdrv, $Mapprn, $RegTweak
call "\\****\netlogon\UDF\mapprint.udf"
CLS
? "Mapping Printers"

$Mapprn = AddPrinter('\\****\fax',"",)
?"Shared Fax "@error ?
$Mapprn = AddPrinter("10.0.0.103","HP Color LaserJet 2500 PCL 6","C:\clj2500\hp2500p6.inf","HP Colour (Copy Room)")
?"CLJ 2500 "@error

IF INGROUP("Students")
$Mapprn = AddPrinter('\\****\HP 3030',"",)
? "MFC HP3030 (Student Area) "@error
ENDIF

Sleep 5



Now my results are entirely different:

Quote:


Mapping Printers
Shared Fax 0

CLJ 2500 1801





After starting to put lines back it seems that the line
$RC = SetOption("NoVarsInStrings","On")
is the culprit that caused the "cannot find the file specified error" and the -2.

So now two questions, am i correct in assuming the problem with the line above is because somewhere in the UDF there is a variable in a string that needs to be resolved?

And can anyone help me figure out how to get rid of the 1801 error?