Skip to content

Instantly share code, notes, and snippets.

@josephkern
Created July 20, 2017 15:53
Show Gist options
  • Save josephkern/18ca113edb10450add90bca40b9ebec5 to your computer and use it in GitHub Desktop.
Save josephkern/18ca113edb10450add90bca40b9ebec5 to your computer and use it in GitHub Desktop.
Map Windows Server Printers to Port Names
function GetPrintersAndPorts {
foreach ($printer in $(Get-Printer)) {
Get-PrinterPort -Name $printer.PortName | select @{name='Printer';expression={$printer.Name}}, PrinterHostAddress
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment