Printing on Citrix is a very intresting topic :). There are many things that you should be awair of to make it working flawlessly.
Her I’m going to show a short script that can help you in identifying inconsistent Printer Drivers accross your XenApp environment.
In a nutshell, we have to make sure that the driver version installed on a Print server or on a Client machine [depending on the type of printing redirection you use] is the same as on a XenApp server.
The manual approach requires as to open a Print Managment console on each of the machines and then do a comparison of the Driver Names and Versions:
If yo have many Servers to check, then this task can be quite challenging.
So lets use Powershell to help as:
cls $Servers = "SERVER1","SERVER2" $Servers += "SERVER3" foreach ($Server in $Servers) { '' $Server # Querying WMI $PrintDrivers = get-wmiobject -class "Win32_PrinterDriver" -namespace "root\CIMV2" -computername $Server # Collect details for every detected printer foreach ($PrinterDriver in $PrintDrivers) { write-host "Name: " $PrinterDriver.Name $Drive = $PrinterDriver.DriverPath.Substring(0,1) # Extracting Driver version info: $DriverVersion = New-Object PSObject -Property @{Version = (Get-ItemProperty ($PrinterDriver.DriverPath.Replace("$Drive`:","\\$Server\$Drive`$"))).VersionInfo.ProductVersion} # Show Driver file version: write-host " Version of the Driver: "$DriverVersion.Version # For logging $PrinterDriver.Name + ',' + $DriverVersion.Version # Extracting Driver path: write-host " Driver Path: " $PrinterDriver.DriverPath # Few more details: write-host " Data File: " $PrinterDriver.DataFile write-host " Configuration File: " $PrinterDriver.ConfigFile write-host } }
As a result we gonna get a list of installed drivers including a version and some other useful details. Here is an example of an output:
Name: HP Color LaserJet 2800 Series PS,3,Windows NT x86 Version of the Driver: 6.1.7600.16385 HP Color LaserJet 2800 Series PS,3,Windows NT x86,6.1.7600.16385 Driver Path: C:\Windows\system32\spool\DRIVERS\W32X86\3\PSCRIPT5.DLL Data File: C:\Windows\system32\spool\DRIVERS\W32X86\3\HPMCPD25.PPD Configuration File: C:\Windows\system32\spool\DRIVERS\W32X86\3\PS5UI.DLL
“Win32_PrinterDriver” class is used to collect tha data – http://msdn.microsoft.com/en-us/library/aa394366%28v=vs.85%29.aspx
Further, generated reports can be aggregated in a nice Excel file 🙂
Unfortunately this won’t work with some type of drivers.
We are using Xerox and the DriverPath for the Xerox references the HP universal driver so we are not getting the correct information.
Here is what I did to compensate for this :
Basically if it’s a Xerox Printer I am getting the information from the “Dependent Files”. The 3rd Item ($driverdetails[2]) is always a DLL for the xerox printers so I am pulling the version from that file.
If you have any other suggestion you are more than welcome as this drived me crazy for a while..
Thank you Carlos for your comment. Yes, the idea is based on finding the file version. Therefore if the DriverPath is pointing to a wrong file then it is not very helpful. On the other hand it’s rather strange that a Xerox printer is using HP Universal Printer Driver.
Thought it can be useful to show what DriverPath and DependentFiles properties are:
I agree.. this is quite odd indeed.
First time I pulled the information for my print servers into a spreadsheet and started reviewing the version I was reaaaaally dumbfounded when I look at the version as it wasn’t making any sense…
FYI, here is the output for one of these Xerox drivers :
You may say, yes this is a universal print driver for Xerox… but here is another one with a dedicated driver :
I am really interested if you have a method in finding the “real” version independently of the driver used… windows does it properly so there must be somewhere else to look … registry ?
thx
Take a look here:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class
My understanding is that related keys are created/populated at the moment of device installations.
looking at the registry I get better information but it is a bit harder to retrieve it :
The “DriverVersion” is has follow : 0 0 0 0 64 6 183 20
which doesn’t coincide at all with the “real” driver version which is 5.303.16.0N 2013.02.08.
I am looking on where that info is located… it eludes me for now .. the version I get from my script above is 6.0.5479.0 which doesn’t coincide at all with the current driver version … the hunt continues ..
And the search is over …
The solution was indeed in the registry.
Problem was that the value was stored as Hexa, by pair and in reverse order …
ie for my xerox it was stored as 00 00 00 00 40 06 b7 14
so translated :
14b7 : 5303
0640 : 1600
and here is my driver version : 5303.1600
so here is my “final script” hoping it will help someone.
I set it as a function.
also I am using a nice module PSRemoteRegistry that allows to remotely check registry keys… very neat.
Great work! Thank you very much.