Scripting Question

Install IP-Printer via VBS/BAT script. What's broken?

03/12/2013 10223 views

I'm attempting to install a network printer on a spread of Windows XP/Vista/7 (all 32bit). 

I have the printer drivers from the OEM and attached them to the script. Which then unzips them to "C:\INF"

Following the unzip, the VBS script is run which calls the .bat file silently. 

Here is the VBS script:

Set WshShell = CreateObject("WScript.Shell")
cmds=WshShell.RUN("c:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\163\installC654.bat", 0, True)
Set WshShell = Nothing

Here's the bat file:


Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r IP_10.2.2.30 -h -o raw

Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prndrvr.vbs -a -m "KONICA MINOLTA C754SeriesPCL" -v 3 -e "Windows NT x86" -h C:\INF -i C:\INF\Driver\Drivers\PCL\EN\Win_x86\KOAYSJ__.INF

Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs -a -m "KONICA MINOLTA C754SeriesPCL" -r IP_10.2.2.30 -p "3rd Floor C654 Copier"


When I manually run the scripts, via admin rights, the printer installs flawlessly.

However, when I push the script from the KBOX, it doesn't work. No failed log messages on the KBOX, none on the client.

Any input on what isn't right?

0 Comments   [ + ] Show comments


All Answers


Are you providing admin credentials in the script?  If it runs with admin rights manually, you probably need to switch to an online kscript and use the "run as" option.

Answered 03/12/2013 by: jknox
Red Belt


I initially ran it as SYSTEM, when that failed, I ran it as domain admin (domain\name, password) with the same results. 

Answered 03/12/2013 by: nseery
Purple Belt


Why don't you run the batch script with 1,True

Also.. Put one "Pause" command at the end of batch file.

So that you can see what is happening actually when this script is executed..

Answered 03/13/2013 by: jagadeish
Red Belt

  • Being new to Windows scripting, what does the 1,True flag change?
    Batch file runs successfully when run on the local machine as admin.
  • objShell.Run (strCommand, [intWindowStyle], [bWaitOnReturn])

    Settings for intWindowStyle:

    0 Hide the window and activate another window.
    1 Activate and display the window. (restore size and position) Specify this flag when displaying a window for the first time.
    2 Activate & minimize.
    3 Activate & maximize.
    4 Restore. The active window remains active.
    5 Activate & Restore.
    6 Minimize & activate the next top-level window in the Z order.
    7 Minimize. The active window remains active.
    8 Display the window in its current state. The active window remains active.
    9 Restore & Activate. Specify this flag when restoring a minimized window.
    10 Sets the show-state based on the state of the program that started the application.
  • When you put 1,True.. This will not hide your cmd prompt when it executing the batch file... I asked you to put "Pause" at the end of batch file to see what is happening when it is executing those command lines... If it is working in Administrator account, it does not mean that it will also work as System account.. In your case first you will have to identify what is wrong with the command lines when it is executed through System acccount
  • prnport works. No errors (this command doesn't require admin rights)
    prndrvr fails with error code 5 (permissions) when pushed with Run As Domain Admin
    prndrvr fails with error code -2146500030 when run as a Local System
    prnmngr fails with error 0x80041003 Access Denied as Local System
  • Are you getting any error when you run the modified script thorugh system account
  • Yes, prndrvr fails with error code -2146500030 when Run As a Local System from the KBOX.
  • Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prndrvr.vbs -a -m "KONICA MINOLTA C754SeriesPCL" -v 3 -e "Windows NT x86" -h C:\INF\Driver\Drivers\PCL\EN\Win_x86 -i C:\INF\Driver\Drivers\PCL\EN\Win_x86\KOAYSJ__.INF

    Can you try with the above command
    • -2146500030: The driver is signed, but either the signer or the certificate in the certificate chain is not the root of
  • Still erroring on prndrvr with -2146500030

After attempting to install a different printer driver, to rule out this driver acting up, I've decided that something is amiss with that driver and working with it via the CLI. What's wrong, I have no clue. 

Trying to install an a different driver results in some totally different, and still weird, errors, but, with enough fiddling, it sometimes works.


Thanks for your help Jagadeish. 

Answered 03/14/2013 by: nseery
Purple Belt

  • I've noticed that Konica drivers are hit and miss when it comes to scripting myself. I just tried to script silent installs using the latest 2013 drivers for a couple of models and I'm getting weird errors as well. The 2010 drivers seem fine though. All of them are signed, but who knows...
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ