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.
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.
I'm going to answer your question with a different method of getting what you want, not a way to do it the way you're asking.
Have you looked into Spiceworks? It does a bang-up job of gathering all (or at least most) of that info and a lot more, and it's free. I work for a consulting firm that does IT assessments for small companies, and we use it to get a really good first-pass of their entire inventory.
They've already put the time into figuring out the hooks of most vendor devices to get this info. If you do it yourself from scratch, you have to know how each printer vendor configured the HTML for their management pages (and there could be multiple product lines per vendor) and you'd have to scrape that. You're going to have to build a database of all printer vendors and product lines, with the way to query the product info for each of them - if it's via SNMP, or telnet, or scraping a HTTP(S) page. Spiceworks will already do that for you.
I'm a big fan of doing something cool and interesting, but I'm a bigger fan of not re-inventing wheels, especially if I'm not selling wheels, I'm driving people around.