Add-PrinterDriver on Windows Server 2012

This question is in addition to the following thread which already was marked as answered:

http://social.technet.microsoft.com/Forums/windowsserver/en-US/7a2db68a-659d-4ba2-b732-52b55b9688cd/addprinterdriver-infpath?forum=winserverpowershell

Here's what I'm currently trying to achieve:

We're currently using 10 printserver appliances for publishing about 1k printer queues to the AD and making them available to the users. Sometime this year those printserver appliances will have to be replaced by a Windows printserver, because of ongoing problems we regularly encounter with the current solution.

I tried to create a PowerShell script to migrate all the printers from the appliances to the Windows server, which checks for published queues in the AD, installs the needed drivers on the Windows server and installs the printers as a last step.

I was rather happy to see that new Cmdlets were introduced with Server 2012 which seemed to be pointed exactly at what I wanted to achieve.

Here's my current problem:

Using Add-PrinterDriver didn't work as it should for a majority of our printers as their drivers are not available in the Windows driver store by default.

Using Add-WindowsDriver didn't work as it only allows drivers to be installed into offline images, not into the currently running system.

Using pnputil to add the driver to the driver store worked great, although it feels like a break in technology usage when calling this from PowerShell.

But, to get down to the core problem, Add-PrinterDriver doesn't seem to recognize a x86 driver in the driver store even if it was successfully added by pnputil. Here's an example with a HP PostScript universal printer driver (commands were taken from the script I mentioned earlier):
PS C:\Windows\system32> pnputil -a $AvailableX64Drivers[$Printer.driverName].Driver
Microsoft PnP Utility

Processing inf :            hpcu155v.inf
Driver package added successfully.
Published name :            oem11.inf


Total attempted:              1
Number successfully imported: 1


PS C:\Windows\system32> pnputil -a $AvailableX86Drivers[$Printer.driverName].Driver
Microsoft PnP Utility

Processing inf :            hpcu155d.inf
Driver package added successfully.
Published name :            oem16.inf


Total attempted:              1
Number successfully imported: 1


PS C:\Windows\system32> Add-PrinterDriver $Printer.driverName -PrinterEnvironment "Windows x64" -ErrorAction Stop

PS C:\Windows\system32> Add-PrinterDriver $Printer.driverName -PrinterEnvironment "Windows NT x86" -ErrorAction Stop
Add-PrinterDriver : The specified driver does not exist in the driver store.
At line:1 char:1
+ Add-PrinterDriver $Printer.driverName -PrinterEnvironment "Windows NT x86" -Erro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_PrinterDriver:ROOT/StandardCimv2/MSFT_PrinterDriver) [Add-PrinterDriver], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070705,Add-PrinterDriver
 

PS C:\Windows\system32> 

The file hpcu155v.inf is confirmed to be the correct x64 driver and the file hpcu155d.inf is confirmed to be the correct x86 driver. Both work correctly when installing them using the printer driver wizard.

  • Edited by DMoenks Friday, January 10, 2014 7:16 AM
January 10th, 2014 10:00am

Hi,

Would you please try other printer drivers instead of HP and see if that worked?

Free Windows Admin Tool Kit Click here and download it now
January 21st, 2014 12:15pm

That doesn't seem to change anything:

PS C:\Windows\system32> pnputil -a $AvailableX64Drivers["Canon iR-ADV C5235/5240 UFR II"].Driver
Microsoft PnP Utility

Processing inf :            CNLB0GA64.INF
Driver package added successfully.
Published name :            oem16.inf


Total attempted:              1
Number successfully imported: 1


PS C:\Windows\system32> pnputil -a $AvailableX86Drivers["Canon iR-ADV C5235/5240 UFR II"].Driver
Microsoft PnP Utility

Processing inf :            CNLB0G.INF
Driver package added successfully.
Published name :            oem19.inf


Total attempted:              1
Number successfully imported: 1


PS C:\Windows\system32> Add-PrinterDriver "Canon iR-ADV C5235/5240 UFR II" -PrinterEnvironment "Windows x64" -ErrorAction Stop

PS C:\Windows\system32> Add-PrinterDriver "Canon iR-ADV C5235/5240 UFR II" -PrinterEnvironment "Windows NT x86" -ErrorAction Stop
Add-PrinterDriver : The specified driver does not exist in the driver store.
At line:1 char:1
+ Add-PrinterDriver "Canon iR-ADV C5235/5240 UFR II" -PrinterEnvironment "Windows  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_PrinterDriver:ROOT/StandardCimv2/MSFT_PrinterDriver) [Add-PrinterDriver], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070705,Add-PrinterDriver
 

PS C:\Windows\system32> 

Please note that I removed the HP drivers with pnputil -f -d before doing this so oem16.inf was used again.

January 21st, 2014 12:46pm

Hi,

Most likely the inf for the driver points to some other files or infs that are not in the default path, so please double confirm the infs and its path.

Free Windows Admin Tool Kit Click here and download it now
February 24th, 2014 1:22pm

Now I've tried it with an even simpler driver for a label printer without complex file/folder structure and just one *.inf file, so there's no cross-linking between files.

Looks just like the same result:

PS C:\Windows\system32> pnputil -a "C:\Users\printer-admin\Desktop\Driver\Phoenix Contact\phoenix.inf"
Microsoft PnP Utility

Processing inf :            phoenix.inf
Driver package added successfully.
Published name :            oem21.inf


Total attempted:              1
Number successfully imported: 1


PS C:\Windows\system32> Add-PrinterDriver "THERMOMARK ROLL" -PrinterEnvironment "Windows x64"

PS C:\Windows\system32> Add-PrinterDriver "THERMOMARK ROLL" -PrinterEnvironment "Windows NT x86"
Add-PrinterDriver : The specified driver does not exist in the driver store.
At line:1 char:1
+ Add-PrinterDriver "THERMOMARK ROLL" -PrinterEnvironment "Windows NT x86"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_PrinterDriver:ROOT/StandardCimv2/MSFT_PrinterDriver) [Add-PrinterDriver], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070705,Add-PrinterDriver
 

PS C:\Windows\system32> 

  • Edited by DMoenks Monday, February 24, 2014 1:20 PM
February 24th, 2014 4:19pm

Did you get this solved? I'm facing an almost similar issue. I need to update drivers, and I also added x86 and x64 drivers with pnputil -a. When I run the Add-PrinterDriver cmdlet it only updates the x64 version of the driver. I get no error messages when trying to update the x86 driver. It just runs as when I add the x64 driver.
Free Windows Admin Tool Kit Click here and download it now
September 13th, 2014 5:44am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics