以编程方式将32位打印机驱动程序添加到64位Windows服务器

目标:自动为Windows 2012 R2打印服务器上的打印机安装x64和x32驱动程序。

信息:到目前为止,我已经能够安装64位打印驱动程序,没有问题。 我试图在现有的打印机上安装x32如下:

# - 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 } 

问题:由于Set-Printer不接受stream水线input,所以我想不出另一种方式来告诉它要安装哪个驱动程序。 x32和x64驱动程序名称是相同的,所以我不知道如何通过使用-DriverName参数进行区分。

这是警察,占位符的答案。 当我能够在Windows上进行一些testing来validation以下内容的准确性时,我想跟进。


从32位Powershell提示符运行工作的“x64”PS1脚本。

从32位应用程序的angular度来看, C:\Windows\system32确实是C:\Windows\SysWOW64 。 请参阅文件系统redirect器 。 我怀疑文件系统redirect器和/或registryredirect器在行为中发挥作用。