I am trying to relate the networked printers IP addresses to the computers in the inventory.  I would like to create a Custom Inventory field that will show all the IP addresses for the networked printers installed on that computer.  So if i would do an advanced search and select that custom inventory field = IP Address, all computers who have that IP Address related to it will show up.  Is there a script to do this. I hope that explaination wasn't confusing. Thanks.

Sorry I meant to add, I am trying to do this on Dell KACE K1000 Management Appliance

0 Comments   [ - ] Hide Comments


Please log in to comment

Community Chosen Answer



maybe try running this from a batch file or shell script on your devices:

Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs -l > C:\printerslist.txt

(more info here: http://technet.microsoft.com/en-us/library/cc725868%28WS.10%29.aspx)

this will output the printers list from prnmngr to a text file that has entries kind of like this:

Server name
Printer name HP Color LaserJet 3600
Share name
Driver name HP Color LaserJet 3600
Port name (printers IP address appears here)
Print processor hpcpp6de
Data type RAW
Attributes 576
Priority 1
Default priority 0
Average pages per minute 0
Printer status Idle
Extended printer status Unknown
Detected error state Unknown
Extended detected error state Unknown

which you can then setup to work as a custom inventory item with a software entry like this:

ShellCommandTextReturn(cmd /c type c:\printerslist.txt)


Answered 12/19/2013 by: Asevera
Blue Belt

  • I don't have a network printer on this system to try it out, but you may be able to use FIND in the custom inventory rule to narrow the information down. Something like this:

    ShellCommandTextReturn(cmd /c type c:\printerslist.txt | find "Printer name"; "Port name")

    More info on the find command: http://ss64.com/nt/find.html
    • In playing around with it (because I like this idea, the IP addresses don't actually come across on the inventory pages under the printer data) I was unable to get "find" to work in the CI rule, so I bypassed it entirely and changed the initial script to filter the data for me. Example:

      del C:\printerslist.txt
      Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs -l > C:\FPL.txt
      findstr /v "Script Copyright Default Server Location Comment Parameters Attributes Priority Average status Extended error Share processor type" C:\FPL.txt > C:\PrintersList.txt
      del C:\FPL.txt

      This kills any existing printerslist.txt, runs the prnmngr command to generate this list to a temporary file, then uses findstr to kill irrelevant lines in the temp file before porting everything to the "final" printerslist.txt. Cleanup of the temp file is last. Ugly? Maybe, but the end result is quite nice. A CI entry with Printer Name, Driver name and Port (IP/USB/ETC) and a total number of installed printers. This also picks up Adobe printers, Faxes, Office file printers, etc.
Please log in to comment
Answer this question or Comment on this question for clarity



Try this on for size, if you just want something basic:

ShellCommandTextReturn(cmd /c powershell.exe "Get-WmiObject -class Win32_Printer | Select-Object Name,PortName")

That will return a formatted table, first column printer name, second column printer port name (which will usually contain IP address for TCP/IP Ports). Of course, the HTML engine will strip out the extra spaces, so it won't format as pretty as if you ran it from a command prompt yourself, but it will make it searchable as you're looking for.

That command will also prevent the need of figuring out how to get a script onto all of your PCs.

Answered 12/20/2013 by: BHC-Austin
Fourth Degree Black Belt

Please log in to comment

I would check out jverbosk's work:



Answered 12/20/2013 by: chucksteel
Red Belt

Please log in to comment
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja