Getting a list of printers published in an Active Directory domain

So I need to get a list of print servers and printers in the domain.

Using Powershell.

Looking around the interwebs, I found a PowerShell commandline here which formed the basis of this commandline:
Get-ADObject -LDAPFilter "(objectCategory=printQueue)" -Properties cn, drivername, location, printername, portname, servername | select portname, cn, drivername, location, printername, servername | Format-Table -Property * -AutoSize | Out-String -Width 4096 | Out-File C:\wisefaq\printerlist.txt

Which outputs to a text file, like this:
portname cn drivername location printername servername
-------- -- ---------- -------- ----------- ----------
{} PRT001-LZR960-2 Dataproducts LZR 960 PS US/UT/Boort/99 Anytown St LZR960-2
{} PRT001-LZR960-1 Dataproducts LZR 960 PS US/UT/Boort/99 Anytown St LZR960-1
{} PRT001-LZR960-3 Dataproducts LZR 960 PCL US/UT/Boort/99 Anytown St LZR960-3
{} PRT001-LZR960-4 Dataproducts LZR 960 PS US/UT/Boort/99 Anytown St LZR960-4
{} PRT001-LZR960-5 Dataproducts LZR 960 PCL US/UT/Boort/99 Anytown St LZR960-5

So why did I use Out-File instead of Export-CSV?
Export-CSV is refusing to output the {ip.addresses}. I don’t know why, and I’ve wasted an hour trying to work around the issue.

PowerShell Quick Tip: Creating wide tables with PowerShell

Searching for Specific Printers in a Domain (Attributes for the printQueue Object)

Print-Queue class

PowerShell print server inventory script (looks very useful, but you need admin access to each of the printers)

“The printer isn’t detecting the correct paper size”

Maladjusted printer On higher-end laser printers, the printer is smart enough to know what size paper you’ve just loaded into the tray.  And the real smart printers won’t try to print from the tray.

“How do you know this?”, asked the customer.

‘Oh, just experience.’

The longer answer is that I remember fixing printers when they weren’t so smart.  Printers which would try and grab 20 pages from a misadjusted paper tray.  Invariably leading to an expensive repair.

“Push customized printers down to XP client machines in domain environment?”

This is a copy of a post which was on Ask MetaFilter, August 2, 2006.

In a Windows Server 2003 domain environment, is there a way to push printers to client machines if they are not shared printers? What about changing printer settings over the network?

I often need to setup networks of about 40 machines with 4 IP printers. They are all identical printers but with different IP addresses. I split them up in groups of 10, with each group printing to one of the printers. I would like to automatically push the printers to client machines.

My first thought was to create a share on the network, ie \\server1\Printers, and then create a login script that installs the printer. The problem with that is, it will attempt to install the printer every time the users log on unless I get rid of the script after the first login, which seems like it’d be counter-intuitive.

The other problem with this is that I need specific printer settings… paper size is Envelope Comm #10, landscape, paper source is Tray 1 (Manual Feed). Even if I could push an installation of the printer with a script, how would I push down these settings?

For my script to install the printer, I had something like this:
start /wait rundll32 printui.dll,PrintUIEntry /if /b "printer_name" /f \\server1\Printers\4350\hpc4x50b.inf /r "IP_192.168.0.252" /m "HP LaserJet 4250 PCL 5e" /z

I’ve read that with Windows Server 2003 R2 there is a new print management tool but I’ve also heard it’s only for network/shared printers.
(Client machines are XP Pro)

posted by Ekim Neems to computers & internet (2 answers total)

The printer share with mount on login (through login script) is the only real way to do this. You can map directly to the IP, but it doesn’t download the drivers to the workstation, configure the default settings of the printer, or allow you to manage who has access through permissions (which is what you’re doing when you mount the share on the workstation).

That is how print admins manage all those complex driver settings for individual users, manage permissions on the printers, and update/downgrade drivers when there are issues.

If you’re still worried about installing the printers every time, through VBScript (or more specifically, WSH) you can enumerate the printers on the workstation and then determine if you want to install the printers. Here’s some sample script:

' Declare variables.
Dim intInstallPrinterFlag, strPrinterName, WshNetwork, clPrinters

' This flag will determine if you want to remove the installed printer first (updated drivers, new settings etc.)
intInstallPrinterFlag = 0

' First argument to the script. Should be in the format \\SERVERNAME\PRINTERSHARENAME strPrinterName = WScript.Arguments.Item(0)

' Declare the WSH object to handle network printer connections.
Set WshNetwork = Script.CreateObject("WScript.Network")

' Enumerate all the printers on the local workstation.
Set clPrinters = WshNetwork.EnumPrinterConnections

' Install the printer, there are none on the workstation.
If clPrinters.Count <> 0 Then
WshNetwork.AddWindowsPrinterConnection strPrinterName

WshNetwork.SetDefaultPrinter strPrinterName

' Now, if there is a printer installed and the install printer flag is set, then remove the existing printer and re-install it.
ElseIf clPrinters.Count > 0 And intInstallPrinterFlag = 1 Then
WshNetwork.RemovePrinterConnection strPrinterName
WshNetwork.AddWindowsPrinterConnection strPrinterName
WshNetwork.SetDefaultPrinter strPrinterName
End If

Save the above in a .vbs file and add to the login script for a user.

This can obviously be built upon (for instance, the duplicate AddWindowsPrinterConnection calls could be wrapped up into a function or sub to prevent duplication.
Extra logic could be added to handle multiple printers on the workstations and how to assign the default printer etc.

If there are any bugs in the script I apologize. I wrote it quickly and from memory. You can find a lot of information about WSH at devguru.
posted by purephase at 12:03 PM on August 2, 2006

As for doing the settings: Open the printer’s Properties sheet, click the Advanced tab, then click the Printing Defaults button. This brings up a window that looks exactly like the usual Printing Preferences window except that the window title is "blah blah Printing Defaults" instead of "blah blah Printing Preferences". Any settings you make here will become the defaults for any new installation of or connection to that printer.
posted by flabdablet at 9:09 PM on August 2, 2006

The Case Of The First Problem Revisited

“Have you got any idea on why this stupid postscript driver for the digital printer/copier keeps spitting out the output below?”

Postscript language dump

‘Yes, the printer does not have the postscript option fitted, and is dumping out the raw postscript language code.’

It’s a variant of the “Case Of The First Problem”, where we had a customer order a printer without the postscript card* fitted.

* – I say card, but most likely these days, the postscript option is installed, but requires an expensive visit from the copier tech to enable the option.

10 free PDF creators, and some split/merge tools

Adobe PDF Logo picture

PDF, as a document format, I find really useful.  I find it useful because I can share a document with you, and it will be formatted as I intended it.  In other words, you’ll see the same page layout as I see.

To create PDFs, I use CutePDF Writer.  I love it so much, that in the past, I deployed to over 10,000+ computers I managed.  But if you’ve tried CutePDF Writer, and didn’t like it, well here are some other choices.

Program 64-bit support? Free?
BullZip PDF Printer Yes (up to 10 users)
CC PDF Convertor ? Yes
CutePDF Writer Yes (non-commercial use)
doPDF Yes Yes
gDoc Yes Yes & No.
PDFCreator ? Yes
PDFTools No Yes
PrimoPDF Yes Yes
Print2PDF – Free Edition Yes Yes
qVPDF No Yes

Got Open Office or Microsoft Office 2007 SP2+
Well you can print to PDF, without using one of the above programs.

Want to spilt and merge PDFs?  Try one of these:
Adolix Split & Merge PDF
Gios PDF Splitter and Merger
PDFill PDF Tools

Bookmark and Share

What is that font?

I was given a paper document which I was asked to scan in and convert to a Microsoft Word document.  That isn’t as hard as it sounds, as Optical Character Recognition (OCR) software has been available for a long time.

What is difficult though, is trying to match up the exact font the original document used.  I’m not a graphical designer, or a typesetter. I work in IT, so recognising a particular font is not easy for me.

Fortunately there is the WhatTheFont site, which makes font detection just a little easier.  It’s a three step process.

  1. You upload a picture of your font
    WhatTheFont - What is this font
  2. WhatTheFont then analyses what you uploaded,
    then asks you confirm each letter,
    WhatTheFont - Character selection
  3. And finally gives you some font choices.
    WhatTheFont - result

I’m going to use “Times New Roman PS”, as I believe it’s the most likely font the original document author used..

Update: This article might be useful: How To Pick The Perfect Typeface

Bookmark and Share

HP Printer Status Notification Pop-up messages

HP makes it easy to hate them.  And I’m not the only one who does.  Angry Technician does a fine line of HP hatingToday’s hate post topic?  The HP Printer Status Notification Pop-up (SNP) message:

HP Status Notification Messages - non admin 

One of our customers complained about the message.  They don’t want to be bugged by any printer messages.  I don’t want to see these messages either, as I think it’s blatant advertising.  “Shop for Supplies”, ha!

The escalated support call landed on my desk.  This was after our talented Level 2 support folks couldn’t find the solution.  I don’t entirely blame them, as you can’t disable it from the customer’s desktop.  The tech I blame is the chap who installed the driver in the first place.  As he/she should have noticed the problem, and disabled SNP.

To remove the notification , you need to log on the server, or PC, which is hosting the printer.  When you do, you see the SNP has an additional option, “Notification Settings”. 

HP Status Notification Messages

Sufficient to say, every HP printer in the Wisefaq domain has this set to Disabled.

Bookmark and Share

Printer toner

Printer toner, depending on who you ask, is cancerogenic.

Or not.

The Material Safety Data Sheets I’ve seen, say not.  But I still wouldn’t breath toner in.

Now some of the printers I’ve worked on over the years, have conspired to leak toner over me. 

There was the StorageTek mainframe printer, with the toner hopper.  You’d open the 5 litre toner container and pour the toner into the hopper.  Great clouds of toner would float up and cover the FNG* tasked to refill the toner.  And because of this, it was only ever the FNG who had to refill the toner on this printer.

The DataProducts LZR960.   You know, you could ship most laser printers and not be to worried that they survive the journey.  The LZR960?  Like a nervous puppy, it would leak toner when the shipping box “This Way Up” sign was not rigorously followed.  Resulting in me being covered in toner, and one expensive service bill later.

Things have gotten better over time, and since I had not had toner leaked on me for a few years, I thought

how much toner was left in the Lanier|Ricoh Photocopier toner cartridge when it said it was “out of toner”?*

An impressively small amount as it turns out.  I’m very impressed that Lanier|Ricoh are not ripping me off on toner.

Other things.

  • In theory, the cartridge is designed to be disassembled.
    Theory is good, but I used a Dremel tool.
  • Cartridge seemed very well engineered.
  • Benefit of hindsight, I would have cut the other end of the cartridge off.  This would have allowed me to have a nice pile like The Angry Technician did.
  • You should wash toner off with COLD soapy water.
    Warm or hot water will cause the toner to bind to you.

* Friendly New Guy
* idea first seen over at The Angry Technician.

Bookmark and Share