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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Printer driver VIA Script

Status
Not open for further replies.

ItIsSolutions

IS-IT--Management
Dec 29, 2003
29
US
I have written my script as shown below however it will not install the printer driver. I downloaded the driver for the HP2430 into c:\24x0 however when i run this script i get a Win32 error code 2.
I do very little scripting and am looking for some help.
Thank you

cscript c:\windows\system32\prndrvr.vbs -a -m "HP LaserJet 2430 PCL 6" -v 3 -e "Windows NT x86" -h "C:\24x0" -i "C:\24x0\hpc24x0c.inf"
 

cscript c:\windows\system32\prndrvr.vbs -a -m "HP LaserJet 2430 PCL 6" -v 3 -e "Windows NT x86" -h "C:\24x0" -i "hpc24x0c.inf"


In the alternative, from the Tek-Tips XP gang:
thread779-581142
 
Wow thank you for your quick response however I had tried that before and it gives me a Win32 error code 87.
 
Code 2 was file was missing. Code 87 is related.

Try:

%systemroot%\system32\cscript %systemroot%\system32\prndrvr.vbs -a -m "HP LaserJet 2430 PCL 6" -h "C:\\24x0\\" -i "C:\\24x0\\hpc24x0c.inf"

 
Rewritten as your very own .vbs script:

Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\.\root\cimv2")

Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objDriver.Name = "HP LaserJet 2430 PCL 6"
objDriver.FilePath = "C:\\24x0\\"
objDriver.InfName = "C:\\24x0\\hpc24x0.inf"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
errResult = objDriver.AddPrinterDriver(objDriver)
wscript.echo errResult

 
Worked Great even changing my driver location.

But I have 1 more long question and have not started searching yet but here goes.

This 2430 has tray 3 installed on it and tray 3 is also the tray that I would like to be set as default input tray.

1. I would like tray 3 to show up as installed when the printer is initally installed.
2. I would like tray 3 set as default input tray when the printer is initally installed.

Any direction someone could point me to would be great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top