Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Proper use of prndrvr.vbs

Posted on 2004-08-17
4
Medium Priority
?
1,182 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 1200 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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…
Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

715 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