Solved

Proper use of prndrvr.vbs

Posted on 2004-08-17
4
1,176 Views
Last Modified: 2008-01-09
I have been trying to use the Windows vbs scripts to install printers through a batch file, I can get the port created and the printer created & working great if the PC already has a driver installed for that printer. But I can't get it to install the driver if the workstation does not already have one, it gives me a "Win32 error 87". I know I am not the best DOS scripter, I don't do it that offten, but am I even close? What I'd like to do is push this out with the driver and force the installation of the driver that I push out with this bat file. Any suggestions?
This is what I got so far.

** THIS IS WORKING **
REM add the TCP/IP port
cscript %windir%\system32\prnport.vbs -a -r IP_xxx.xxx.xxx.xxx -h xxx.xxx.xxx.xxx -o raw -n 9100

** THIS IS NOT WORKING **
REM install the printer driver
cscript %windir%\system32\prndrvr.vbs -a -h "c:\temp\lj2300n" -i "hpc2300c.inf" -m "HP Laserjet 2300 Series PCL 6" -v 3 -e "Windows NT x86"

** THIS IS WORKING - IF THERE IS A DRIVER INSTALLED ON THE PC ALREADY **
REM Add printer to the port you just created
cscript %windir%\system32\prnmngr.vbs -a -p "Chip" -m "HP Laserjet 2300 Series PCL 6" -r IP_xxx.xxx.xxx.xxx


Thanks for your time!!!
 RBennett
0
Comment
Question by:Ryan Bennett
  • 2
  • 2
4 Comments
 
LVL 30

Expert Comment

by:SteveGTR
ID: 11864604
Modify prndrvr.vbs and enable debug trace output. Change this line:

gDebugFlag = false

to:

gDebugFlag = true

Hopefully that will shed some like on the problem.

Good Luck,
Steve
0
 
LVL 30

Accepted Solution

by:
SteveGTR earned 300 total points
ID: 11864661
The error, Win32 error 87 means ERROR_INVALID_PARAMETERS, but your parameters looks good to me. Check the path and file name for correctness. Is the driver already installed and is this how the script tells you this when you attempt to add an existing driver? You could try and delete it first piping the output to NUL:

cscript %windir%\system32\prndrvr.vbs -d -m "HP Laserjet 2300 Series PCL 6" -v 3 -e "Windows NT x86" 2> NUL > NUL



0
 

Author Comment

by:Ryan Bennett
ID: 11903508
I will try these and get back.

 Thanks for your comments!!

RBennett
0
 

Author Comment

by:Ryan Bennett
ID: 12058739
Sorry it took so long to get to this, but that did the trick!

 Thanks a lot.
RBennett
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now