1

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?

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
LegalITTech
  • 11
  • 1
  • 5
  • 3
    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 03 '09 at 12:13

3 Answers3

2

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")
    Else
      WScript.Echo("---")
    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")
    Else
       WScript.Echo("---")
    End If

Next
splattne
  • 28,348
  • 19
  • 97
  • 147
  • 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 03 '09 at 13:42
0

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.

Result.

LegalITTech
  • 11
  • 1
  • 5
0

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

Sim
  • 1,858
  • 2
  • 17
  • 17