Need simple printer script

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I need to list, to a .csv file preferably, all the printers on my print
server. I'd like the printer name and the ip address. I believe this will
be sufficent for what I need.

When I search the net, I find script to install printers, which I don't want
to do. And I've found a script to Enumerate Printer Port Properties, which
will give me the address, but for the name, I need another script I found
that will List Printer Capabilities.

I THINK I could pull enough of what I need from each to get what I want, but
I don't know what ties them together. I mean, how do I get the same printer
for port 123, when I'm retreiving capabilities to get the name?

( The 'Description' property is always empty when I read thru the port
properties. )

Here's one script I found:

-----
strComputer = "."

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

Set colPorts = objWMIService.ExecQuery _
("Select * from Win32_TCPIPPrinterPort")

For Each objPort in colPorts
Wscript.Echo _
"Description...( " & objPort.Description & " )" & VbCrLf & _
"Host Address...( " & objPort.HostAddress & " )" & VbCrLf & _
"Name...( " & objPort.Name & " )" & VbCrLf & _
"Port Number...( " & objPort.PortNumber & " )" & VbCrLf & _
"Protocol...( " & objPort.Protocol & " )" & VbCrLf & _
"SNMP Community...( " & objPort.SNMPCommunity & " )" & VbCrLf & _
"SNMP Dev Index...( " & objPort.SnMPDevIndex & " )" & VbCrLf & _
"SNMP Enabled...( " & objPort.SNMPEnabled & " )"
Next
-----

And here's the other:
-----
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_PrinterConfiguration")

For Each objPrinter in colInstalledPrinters
Wscript.Echo "Name: " & objPrinter.Name
Wscript.Echo "Collate: " & objPrinter.Collate
Wscript.Echo "Copies: " & objPrinter.Copies
Wscript.Echo "Driver Version: " & objPrinter.DriverVersion
Wscript.Echo "Duplex: " & objPrinter.Duplex
Wscript.Echo "Horizontal Resolution: " & _
objPrinter.HorizontalResolution
If objPrinter.Orientation = 1 Then
strOrientation = "Portrait"
Else
strOrientation = "Landscape"
End If
Wscript.Echo "Orientation : " & strOrientation
Wscript.Echo "Paper Length: " & objPrinter.PaperLength / 254
Wscript.Echo "Paper Width: " & objPrinter.PaperWidth / 254
Wscript.Echo "Print Quality: " & objPrinter.PrintQuality
Wscript.Echo "Scale: " & objPrinter.Scale
Wscript.Echo "Specification Version: " & _
objPrinter.SpecificationVersion
If objPrinter.TTOption = 1 Then
strTTOption = "Print TrueType fonts as graphics."
Elseif objPrinter.TTOption = 2 Then
strTTOption = "Download TrueType fonts as soft fonts."
Else
strTTOption = "Substitute device fonts for TrueType fonts."
End If
Wscript.Echo "True Type Option: " & strTTOption
Wscript.Echo "Vertical Resolution: " & objPrinter.VerticalResolution
Next
-----

Like I said, I just want the printer name and the port.

Anyone know how I need to do it?

Thanks in advance,

Tom

.



Relevant Pages

  • RE: Deploying Fonts on 100 Computers
    ... script this, or you might try running it as a machine script rather than a ... user script to do the write under the machine account. ... "Haroon Malik" wrote: ... To install standard windows fonts, you need to get the .ttf or .fon files ...
    (microsoft.public.windows.server.active_directory)
  • Re: I see no script fonts in my WORD 2003
    ... Go to Control Panel | Add or Remove Programs, select Microsoft Office ... Features and check the box for a custom install. ... Fonts is under Office Shared Features. ... >> Edwardian Script, Freestyle Script, French Script, Kunstler Script, ...
    (microsoft.public.word.docmanagement)
  • CTAN Update: installfont
    ... Summary description: A bash script for installing a Postscript Type1 font family. ... The script will rename the fonts automatically (optinal) ... This package is located at ...
    (comp.text.tex)
  • Re: navigation/txt. links
    ... > Does Google consider the navigation in the Shared border ... You mean the navigation bot (because one can type a menu into the shared ... Different colours of fonts different sizes different fonts... ... that was not showing and you have the no right click script on the site... ...
    (microsoft.public.frontpage.client)
  • Re: SI units (was: Expressing fractions)
    ... >> of a foreign script here and there, ... So do fonts for the big5 encoding (for traditional Chinese ... matrix of Chinese characters. ...
    (sci.lang)