Powershell scan for network attached printers

networkingpowershellprinting

Currently I'm working on creating a PS script to scan a network and retrieve all of the Windows Servers, their product keys, SQL Server product keys, CPU, RAM, Network Shares and Services on all the Windows servers found. Basically this is to compile a list of information for site-evaluations before merging networks into ours when our company purchases a new office/other company. So far I've been able to get all of this part working fairly neatly, with the information being pushed to .txt or .csv files.

The only other major part missing from the information I want to gather is network printers. So far the closest thing I can find is a method to return the uPNP devices on the network, which does not return all of the printers. The only ones it's returning currently are Ricoh MFPs and we also have a mix of HP and other printers on the network as well.

My question is if there is a method or a function within Powershell to retrieve the IP, Make and Model of printers on a network? Currently the script takes the users input for a network to scan in the form of X.X.X.0 and retrieves information on a per-IP basis (via a loop and counter) up to X.X.X.254 so if the method/cmdlet is IP/host specific that is fine.

I've not found anything for retrieving printers' info using PS other than getting local printers or printers off of a print server and most of the companies we deal with do not have print servers.

Thanks ahead of time.

Best Answer

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.

Related Topic