GOAL: To install both x64 and x32 drivers for printers on a Windows 2012 R2 print server automatically.
INFORMATION: So far, I've been able to install x64 print drivers with no problem. My attempt to install x32 on existing printers is below:
# - Set the driver name
$driverName = "HP Universal Printing PCL 6"
# - Get a list of printers that already have x64 drivers installed
$printers = get-Printer | where {$_.drivername -eq $driverName}
Foreach ($printer in $printers) {
# - This is the only way I could think to get the x32 print driver. It is already installed on the system with pnputil
$driver32 = get-printerdriver | where {$_.name -eq $driverName -and $_.printerenvironment -eq "Windows NT x86"}
# -- Turn off the share so we can add the driver.
$sharename = get-printer -name $printer | select -expand ShareName
set-printer -name $printer -Shared $false -confirm:$false
# -- This does not work. The set-printer cmdlet does not accept pipeline input.
$driver32 | set-printer -name $printer -confirm:$false
# -- Re-share the printer.
set-printer -name $printer -Shared $true -Sharename $sharename
}
PROBLEM: Since Set-Printer does not accept pipeline input, I can't think of another way to tell it which driver to install. The x32 and x64 driver names are identical, so I don't know how to differentiate by using the -DriverName parameter.