Printer port/ip addresses

Re: Printer port/ip addresses

Fayyaz, there is a tool called Scriptomatic..available from microsoft. You can find it here http://www.microsoft.com/downloads/details.aspx?FamilyID=09dfc342-648b-4119-b7eb-783b0f7d1178&DisplayLang=en
Once you download and unzip the file, run the scripromaticv2.hta.
Select WMI Source and put in the fqdn name of the server that has the print queues. Then scrool down on the WMI Class drop down list and find **“Win32_TCPIPPrinterPort”. **In the target computers put the name of the server and hit update script. Then select Run… Viola…you have all the printers. Here is the script it produces.

On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array(“SPRB4STQ51”)
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo “==========================================”
WScript.Echo "Computer: " & strComputer
WScript.Echo “==========================================”
Set objWMIService = GetObject(“winmgmts:\” & strComputer & “\root\CIMV2”)
Set colItems = objWMIService.ExecQuery(“SELECT * FROM Win32_TCPIPPrinterPort”, “WQL”, _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "ByteCount: " & objItem.ByteCount
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "CreationClassName: " & objItem.CreationClassName
WScript.Echo "Description: " & objItem.Description
WScript.Echo "HostAddress: " & objItem.HostAddress
WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate)
WScript.Echo "Name: " & objItem.Name
WScript.Echo "PortNumber: " & objItem.PortNumber
WScript.Echo "Protocol: " & objItem.Protocol
WScript.Echo "Queue: " & objItem.Queue
WScript.Echo "SNMPCommunity: " & objItem.SNMPCommunity
WScript.Echo "SNMPDevIndex: " & objItem.SNMPDevIndex
WScript.Echo "SNMPEnabled: " & objItem.SNMPEnabled
WScript.Echo "Status: " & objItem.Status
WScript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
WScript.Echo "SystemName: " & objItem.SystemName
WScript.Echo "Type: " & objItem.Type
WScript.Echo
Next
Next

Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & “/” & _
Mid(dtmDate, 7, 2) & “/” & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & “:” & Mid(dtmDate, 11, 2) & “:” & Mid(dtmDate,13, 2))
End Function