Add printer driver to Windows 7 8 2008 R2 using a command line

Adding print drivers to Windows 7 or Windows 2008 (R2) using a script isn’t as easy as it was in earlier versions.

Sure, we can use 3th party products as RES Automation Manager to install printer drivers but that product has a price.

In this blog post I am going to walk through the steps necessary to install the printer drivers using a command line.

Let’s get started.

Name

    Every driver has a name. When we have found the Name we can use this to fill in the script value.
    You can find the Name if you run the following command:

rundll32.exe printui.dll,PrintUIEntry /ii /f C:\epson374750eu\E_GF1HKP.INF

replace C:\epson374750eu\E_GF1HKP.INF with the name of your INF file.

Click The Printer that I want isn’t listed
SNAGHTML6cce84d
Click Next image
Click Next image
Write down the name and the INF file name

Click Cancel

SNAGHTML6cdad72
    Repeat this step for each INF file.

 

The name is EPSON TX235 Series. 

If you cannot find the information using these steps, you can always install the driver on a dummy system. After installing the driver, there is an entry created under HKLM\System\CurrentControlSet\Control\Print\Environments\*Environment*\Drivers\Version-*\*name*

Script

I am not going to use the Epson name found above, I use an other driver for the next steps.

The script to add a printer driver is:

Cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs -a -m "Xerox Global Print Driver PCL" -i "C:\Xerox\x2UNIVL.inf"

-a is Add

-m is the Name

-i is the location of the INF file

image

Repeat this step for every INF file.

 

Possible errors

If you receive a Win32 error code 87 first check the the name. Again, If you cannot find the information from the INF file, you can always install the driver on a dummy system. After installing the driver, there is an entry created under HKLM\System\CurrentControlSet\Control\Print\Environments\*Environment*\Drivers\Version-*\*name*

 

image

 

Can’t get the solution to work? Contact me and let me do the trick.

 

 

 

Advertisements
This entry was posted in Microsoft General. Bookmark the permalink.

2 Responses to Add printer driver to Windows 7 8 2008 R2 using a command line

  1. While creating new Windows 7 images, I found that if I copy the HP universal driver then install it post sysprep via a follow up batch file and run cscript c:\windows\system32\printing_admin_scripts\en-us\prndrvr.vbs -a -m “HP Universal Printing PCL 6” -h “c:\Drivers\HP-pcl6-x32-5.6.0.14430” -i “c:\Drivers\HP-pcl6-x32-5.6.0.14430\hpcu140c.INF”, my restricted users can install IP-based printers. That’s a biggy for us. Now they run this batch file: cscript c:\windows\system32\printing_admin_scripts\en-us\prnport.vbs -a -r “HP2100” -h 192.168.1.116 -o raw -n 9100
    cscript c:\windows\system32\printing_admin_scripts\en-us\prnmngr.vbs -a -p “HP2100” -m “HP Universal Printing PCL 6” -r “HP2100” .
    Sure makes my job easier not having to install printers for users and I hate using server-based printers. I don’t see any reason for print job packets to go outside my subnet and use our WAN when the printer is 10 feet away from the user.

  2. TheWagner says:

    Thank you very much for this.
    Together with the comment of George Jenkins it made it easy for me to install my printers unattended 🙂

    Keep it up

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s