Powershell or WMI to pull Printer Properties and Additional Drivers

powershellscriptingwindows-server-2008wmi

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:

PCLOADLETTER
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.

Best Answer

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.

Related Topic