Solved

Proper use of prndrvr.vbs

Posted on 2004-08-17
4
1,180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DOS command won't run from WScript.Shell 8 63
DOSBox Keyboard 3 104
Help with a batch file 13 85
Copy dir and files with robocopy 2 73
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…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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