I received some comments from people stating it did not work on Windows 8 and 10.
Looking into this I found out that if you don’t add a shared printer from an print server but create it from control panel with a new TCP/IP port the Network property will not be True.
So I ended up checking if the PortName matches an IP address.
Check the end of this post for some examples.
How PowerShell can make your day easier:
It all started when I had added a LOT of printers on my Win 7 client due to testing of new printer drivers/server. When I wanted to delete them I found out that it not possible to mark them all and delete.
You actually have to delete one at the time which of course is very time consuming. So I wanted to create a PowerShell script that would do it for me. With a little help from my colleague Oddvar Håland Moe I have created a “one-liner” that will delete all the network printers on your client.
NB: This will only remove the mapped printers, All drivers that have been added will not be removed.