0

I often need to find the Windows print queue name or share name of a printer connected to our network using just the IP address of the printer. I can use PowerShell to list all of the printers on a server but there are hundreds to read through (and multiple servers) to find a specific IP.

I'm trying to use this command in PowerShell but when I run it, PS just returns to the prompt with no output (and no error message).

Get-Printer -Computername %computername | Select Name,Portname | Where-Object {$_.PortName -eq "IP address"}

I'm a complete newb with PowerShell and scripting in general. This seems like it should work but I'm not sure why it's not giving me an output.

Dave M
  • 4,514
  • 22
  • 31
  • 30
AvgJoe
  • 1

1 Answers1

0

Sometimes it's the little things.

It will work with single quotes instead of double quotes. I'd have to really dig into the language specification to figure out why that is.

Also, in this specific case, there's not a lot of value to the "Select Name,Portname" command since you're not doing much with that array. You can save yourself some time by omitting it.

DoubleD
  • 141
  • 4