What I am trying to accomplish:

Use a powershell script (WMI or cmdlets directly, or a combination) to query a 2003 or 2008 server with the PrintServer role, enumerate the printers shared, then list the drivers in use for that printer and specifically if an x86 or x64 driver is being used (or both).

I've looked at Win32_Printer, Win32_PrinterDriver, Get-Printer, etc. None of these seem to be able to tell me about x64 drivers or when multiple platform-specific drivers are loaded. Something like:

gwmi win32_printer -computername lebowski | %{$name = $_.name
$supported = $_.getrelated('Win32_PrinterDriver') | select supportedplatform, driverpath, version
Write-Host $name
return $supported 

Produces the following:

supportedplatform : Windows NT x86
driverpath        : C:\WINDOWS\system32\spool\DRIVERS\W32X86\3\RIC54Dc.DLL
version           : 3

However the problem being that particular printer also has x64 drivers loaded. I really don't want to manually check the properties tab of 100 printers just to see if they have the x64 driver loaded.


Your script looks good. Might I suggest using Select-Object name, driverpath as opposed select supportedplatform, driverpath, version.

The output then looks like:

Xerox WorkCentre Pro C3545 PS,3,Windows x64 C:\Windows\system32\spool\DRIVERS\x64\3...

Xerox WorkCentre Pro C3545,3,Windows NT x86 C:\Windows\system32\spool\DRIVERS\W32X8...

Granted, still probably not as clean as you would probably like it. This will (I think) give you what you're looking for.

|improve this answer|||||

This is a very interesting puzzle.

The closest I can suggest is this:

Run your powershell script twice:

Once "native" (which on an x64 system will run as 64 bit) and again as 32 bit. In 32 bit mode, you should only see printers that have 32 bit drivers (I am speculating a little here, but suspect this will be true).

You can see how to run your script as x86 and x64 in a few articles. Here is one: http://www.gregorystrike.com/2011/01/27/how-to-tell-if-powershell-is-32-bit-or-64-bit/

The same script will run fine as either 32 or 64.

Then, if the above is behaving as expected, make the script save list to file, e.g.

32bitprinters.txt 64bitprinters.txt

And then a second script compares the lists, or does what you need.

|improve this answer|||||
  • That is a good theory. The print server in question is 32bit 2003 and my workstation is 64bit Win7. However when adding the new function (in the linked blog post) into my little script and running it on the server directly produces a 32bit case result but otherwise the same output. Using the additional function on my machine produced a 64bit case but the same resulting output, e.g. supported platform still only comes back with Windows NT x86 – JeremiahJohnson Jun 1 '12 at 18:29
  • I should note that "Using the additional function on my machine produced a 64bit case but the same resulting output, e.g. supported platform still only comes back with Windows NT x86 " what I meant was that I was still pointing the script to gwmi win32_printer -computername 200332bitprintserver. If I use the script on my 64bit machine and just tell it to gwmi win32_printer -computername win764bitmachine it will produce the following output: supportedplatform : Windows x64 – JeremiahJohnson Jun 1 '12 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.