Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

  1. Add a new port for this printer:
       Add-PrinterPort -Name Sales_Color2  `
                       -PrinterHostAddress   10.10.10.62
  1. Create a printer pool for printer SGCP1:
      $printer = 'SGCP1'
      Rundll32 PrintUi.dll,PrintUIEntry /Xs /n 
"$Printer" Portname 'Sales_Color2,Sales_Color'
  1. To see the results, get the printer details and display them as a nice table:
      Get-Printer SGCP1 |
          Format-Table -Property Name, Type, 
DriverName, PortName