Tuesday, 14 February 2012

Accessing Twain and WIA devices via Citrix Xendesktop

In an environment such as a school there is a need to be much more flexible than a corporate entity. There is a need for more relaxed permissions, multiple users on single computers and a high level of customization.

This flexibility extends itself to the VDI farms, specifically with the ability to plug devices such as scanners into any virtual desktop and have instant access.

I was recently tasked with setting up a legacy Canon "CanoScan" device. When this device was originally released it only had a TWAIN driver but in the past 12 months a WIA driver has also been made available.



TWAIN Pain

TWAIN is now quite legacy, in fact since Photoshop CS4 Adobe has been trying to remove it from their products, offering compatibility with an optional plug-in. Adobe explains their move to remove TWAIN support from Photoshop is "Because TWAIN is an older technology that is not regularly updated for new operating systems, TWAIN often causes issues in Photoshop."

I didn't have any luck with simply passing the scanner through as a USB device and using the TWAIN driver within the VDI, applications simply didn't detect the scanner.

Fortunately for Xendesktop users Citrix has made available a TWAIN redirection option in XD 5.5. This option can be difficult to get working, depending on your Citrix client receiver version, the driver for your scanner and in which direction the wind is blowing on the day.

My advice to you is avoid TWAIN with Xendesktop if possible, try and find a WIA driver. If Twain is unavoidable you can try a few things to get it working smoothly.
  • Ensure XD is at 5.5 or higher
  • Ensure the HDX user policy "Client TWAIN device redirection" is enabled
  • Upgrade client online plugin versions to receiver 3.0+
  • Ensure you are running the latest Twain driver available
Some users have also reported having success with disabling "Client USB device redirection" all together or alternatively using the HDX user policy "Client USB device redirection rules" to deny the re-direction of just the scanner as a USB device.

For example your could add the following deny rule if your VENDOR id is 1234 and PRODUCT id is 9876.

Deny: VID=1234 PID=9876


This will block your scanner from being passed through as a USB device, allowing the TWAIN device redirection policy kicks in. I don't know on a technically level how the TWAIN device redirection works. The device doesn't appear in the device manager and no local driver is required but when you launch your scanning application the scanner works perfectly.



WIA Plea-se

Okay that was a horrible rhyming attempt, but WIA isn't so horrible to configure with Xendesktop. Actually in my case it was the exact opposite of TWAIN.

Simply grab the latest WIA driver, install it onto your virtual image, wait for your virtual desktops to update to the latest vDisk version and insert your USB scanner. Simple!

The scanner will be passed through as a USB device. pending you have USB redirection enabled or at least an "ALLOW:" rule for the scanner under the "USB redirection rules" user HDX policy. When it is inserted it will appear as a normal USB device, the driver you previously installed will kick in and then applications will detect it as a native WIA scanner.

If at all possible, go straight to WIA and save yourself some grey hairs. If WIA isn't a possibility, grab a triple espresso, put aside a few hours and start playing with settings combinations.

1 comment:

  1. James,

    thanks for this post i am haveing a very very anoying issue!

    i had a fujitsu scanner 6130 which is being pullded thru as usb device not Twain.

    i can scan with in citrix fine but not with in programs like adobe and volume which use Twain ...

    i have tired to follow what you have said but with no joy.

    can you give any other advice it would be most helpfull.

    ReplyDelete