Powershell scan for network attached printers

So to half-way solve the issue I found a method to check for responses on port 9100, which is used by most network printers, and output the IP list to a Printers.csv file. This will act as a reference to fill in printer addresses manually later. Some of the methods used were extracted from this article in case anyone else wishes to reference it. I changed the port to 9100 and set an IF statement to push IPs into an array while looping through the network, then push the array to the .csv.

So far this has worked on Ricoh, HP and Konica printers in our environment. Hope this helps anyone else who may be working with Powershell to create a quick scanning script.

UPDATE:

Here is a copy of the .ps1 file I've made so far in case anyone else is working on a similar project. It doesn't return ESX server names or printer makes and models but at least puts the IPs in a CSV so you know where to start looking.