Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I hope someone can help, my brain is fried! In W2K3, I can use prnmngr.vbs and get absolutely everything I need from the print server to list installed queues, port names, driver details, IP addresses etc.

But on Server 2000, the script doesn't work and I can't find a way to obtain a list of installed TCP ports and associated IP addresses.

Any ideas?

share|improve this question
You may want to fix your subject and question to make it clearer that you're talking about print servers. "TCP ports" usually refer to part of the TCP/IP protocol and may be confusing in this context. – David Pashley Jun 3 '09 at 12:13

You could use the following script. Save it under "printerlist.vbs" and call it using cscript.exe printerlist.vbs (so you'll get the output on the command line console.)

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_Printer")

Set WshNetwork = WScript.CreateObject("WScript.Network")

WScript.Echo("This Computer's Name = " & WshNetwork.ComputerName)

For Each objPrinter in colInstalledPrinters

    If (objPrinter.Attributes AND 4) = 4 then
      WScript.Echo("*****> Default printer -- Start")
    End If

    WScript.Echo("Name: " & objPrinter.Name)
    WScript.Echo("Share name: " & objPrinter.ShareName)
    WScript.Echo("Driver name: " & objPrinter.DriverName)
    WScript.Echo("Caption: " & objPrinter.Caption)
    WScript.Echo("Port: " & objPrinter.PortName)
    WScript.Echo("Location: " & objPrinter.Location)
    WScript.Echo("Description: " & objPrinter.Description)
    WScript.Echo("Server: " & objPrinter.ServerName)
    WScript.Echo("System name: " & objPrinter.SystemName)
    WScript.Echo("Print processor: " & objPrinter.PrintProcessor)

    If (objPrinter.Attributes AND 4) = 4 then
       WScript.Echo("*****> Default printer -- End")
    End If

share|improve this answer
Thanks, that's very handy and combines the most usefull features in the VB scripts I've been using. Unfortunately, it still doesn't report the IP address for each port name (objPrinter.Portname returns the name the port was given, which is not the same as the IP). Any other ideas? – LegalITTech Jun 3 '09 at 13:42

I finally cracked it. The provider wasn't available for quering ports on W2K server, but the solution was simple after all that. I just exported the registry keys for the ports on the current config and cleaned it up in Excel. Voila! Using the report generated from print queues created on the server, I combined the data and can now compile a full inventory of devices with queues on my W2K print server.


share|improve this answer

Here is a link to PowerShell for Printers which you might find helpful for future reference.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.