Query AD for Printer info

Expanding on my code to query single printer information, I found I could pull all networked printers from Active Directory(AD). This will help in cleaning up the naming standard for all our printers. Hopefully making DNS cleaner by using a single standard for host(A) records. Final file is written to c:\printer-info.csv. The attached script will return the following:

  • Printer name
  • Server name - where hosted
  • Port - name of printer port (local or network)
  • Share name
  • Host address (what the port points to) - requires Windows 2003 or XP print server
  • Protocol (RAW or LPT) - requires Windows 2003 or XP print server
  • RAW Port (if using RAW) - requires Windows 2003 or XP print server
  • SNMP Community (if enabled) - requires Windows 2003 or XP print server
  • Host Name - as pulled from DNS - requires IP Address, captured in Host Address field Windows 2003 or XP print server

To get the script to run, you will need to modify this line (#19) to match your current environment.

Const MyDomain = "DC=my_domain_goes_here,DC=com"

Sources: Microsoft, Microsoft, and Geek Speak

AttachmentSize
EnumPrinters.vbs.txt6.87 KB

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <blockquote> <center> <hr> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options