Add-PrinterPort / Set-Printer Issue

I was able to resolve the issues I was having.

To add a new printer port it needed to be done independently of the name to use. Whereas I was using

Add-PrinterPort -Name $($Printer.PortName.Replace("\\printman\","\\cacitspdquepr1\"))

What I needed to use was

$NewPort = $Printer.PortName.Replace("\\printman\","\\cacitspdquepr1\")
Add-PrinterPort -Name $NewPort

Similarily with Set-Printer, where I was using

Set-Printer -Name $Printer.Name -PortName $($Printer.PortName.Replace("\\OLD\","\\NEW\"))

It needed to be

$ThisPrinter = Get-Printer -Name $Printer.Name
Set-Printer -Name $ThisPrinter.Name -PortName $Printer.PortName.Replace("\\OLD\","\\NEW\")
1 Like