9 November 2011

Enable the Citrix Desktop Viewer with XenApp



The Citrix Desktop Viewer toolbar if officially supported with XenDesktop only, but also works with XenApp. The Desktop Viewer is enabled on the each Web Interface/Web Services site in WebInterface.conf by adding the line ShowDesktopViewer=On
The Desktop Viewer can also be enabled and disabled in default.ica on each Web Interface site where ConnectionBar=0 disables and ConnectionBar=1 enables the Desktop Viewer. This setting is found in the [Application] section.


Note that once the Desktop Viewer is enabled the display settings from the farm and Web Interface are ignored – the idea being that Desktop Viewer gives the user control of how to size and place their desktop session. Enabling the Desktop Viewer on a desktop appliance site where a published desktop automatically opens full screen will break this functionality; the desktop session will open in a window instead.

24 October 2011

How to determine the client IP address in XenApp 6

I have been modifying a client's 2500 line VBScript login script recently (what a beast!) and had to find a replacement for ICACLIENTINFO.EXE which was used in their Presentation Server 4.0 environment to determine the client IP address and map printers based on subnet. ICACLIENTINFO.EXE does not work with XenApp 6/6.5, so I had to find a replacement method. After some hunting through the registry I found this:
HKLM\SOFTWARE\Citrix\Ica\Session\2\Connection\ClientAddress
Now I just had to find a way to determine the Session ID, which was easier than I thought:
HKCU\Volatile Environment\2


And now to put it together into a script:
Set objShell   = CreateObject("Wscript.Shell")
aRegKeys       = RegEnum(".", "HKCU", "Volatile Environment")
sessionID      = aRegKeys(0)
strIPCTXClient = objShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Ica\Session\" & sessionID & "\Connection\ClientAddress")

WScript.Echo "Client IP Address: " & strIPCTXClient



'************************************************************************
'* 
'*  Function RegEnum()
'* 
'* Purpose: Enumerate all subkeys of the specified registry key.
'*
'* Input: strHkey - registry hive (HKLM, HKCU etc)
'* strKey - the registry key to enumerate
'*
'* Output:  An array of the subkeys. An empty array is returned for an error.
'*
'************************************************************************
Function RegEnum(strTarget, strHkey, strKey)
Const VBObjectError = -2147221504 
Const FUNCTIONNAME = "RegEnum ()"

Dim intHkey

Const HKEY_CLASSES_ROOT   = &H80000000
Const HKEY_CURRENT_USER   = &H80000001
Const HKEY_LOCAL_MACHINE  = &H80000002
Const HKEY_USERS          = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
 
Select Case UCase(strHkey)
  Case "HKCR"
intHkey = HKEY_CLASSES_ROOT
  Case "HKCU"
intHkey = HKEY_CURRENT_USER
  Case "HKLM"
intHkey = HKEY_LOCAL_MACHINE
  Case "HKU"
intHkey = HKEY_USERS
  Case "HKCC"
intHkey = HKEY_CURRENT_CONFIG
  Case Else
 Err.Raise vbObjectError, FUNCTIONNAME, "Invalid HKEY: " & strHkey
 RegEnum = Array()
 Exit Function
End Select

On Error Resume Next
Dim objReg
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_ 
strTarget & "\root\default:StdRegProv")

If Err <> 0 Then
RegEnum = Array()
Exit Function
End If

' Get all subkeys in the specified key
Dim arrSubKeys
objReg.EnumKey intHkey, strKey, arrSubKeys

If Err <> 0 Then
RegEnum = Array()
Exit Function
End If

If IsArray(arrSubKeys) Then 
RegEnum = arrSubKeys
Else
RegEnum = Array()
End If

End Function

11 August 2011

Citrix acquires RingCube

Citrix have just announced their acquisition of RingCube, it's been an active few months for Citrix with their recent acquisition of Kaviza. RingCube's vDesk product fits in the user virtualisation/user personalisation category along with products from Unidesk and AppSense. vDesk is much more than user profile management (likewise for the Unidesk and AppSense products), to quote RingCube's website "The vDesk workspace separates the user's desktop environment, including applications, data, and settings, from the operating system"..... "When administrators need to provision new applications, update existing applications or deliver data to the users' workspace, they simply make the change in the master workspace, apply the new version of the master to the user or group, and a differential update is automatically pushed to the user at their next login."
I love the concept, especially being able to centrally update an application and have the update apply to all users while not blowing out disk storage. My question is how effective this is over the long term: changes to the master workspace must be stored in a per user workspace, which over time will continue to grow - after two years how big has an average user workspace become? Are there any means to control this organic growth? User profile management will become "user personalisation management" encompassing not only the user profile, but user installed applications and user data as well.
This is a big feather in Citrix's cap and will certainly add value to their product suite. Will we now see VMware making an acquisition to play catch up? Based on recent twitter activity is seems that Unidesk is the most like target.
Now when as a Citrix Partner will I be able to get my hands on vDesk??

11 July 2011

Stress testing print drivers on XenApp

While dodgy print drivers no longer often cause a BSOD, they are still an on-going source of issues on Citrix XenApp farms, namely print spooler crashes and application crashes. Resolving print driver problems within a production environment is challenging and time consuming due to user testing and the change control requirements of live environments, so suck it up and spend the time doing thorough testing during the project to ensure you don't enter a world or printer pain later on.
My interpretation of thorough is stress testing the print driver using Citrix's StressPrinters utility followed by UAT to ensure the printer driver meets the user's needs.

I just wrote the following guidelines for a client and thought I would share:

Use the Citrix StressPrinters utility to test print drivers before they are introduced into the XenApp farm. A test XenApp server must be used during stress testing to ensure the new print driver is not introduced into the production farm prior to successful testing.

  1. Install the print driver onto the test XenApp server
  2. A Printer Port must be created for use during the test. Open Print Management, expand the local Print Server right click Ports and select Add Port.
  3. Choose Local Port, click New Port and enter the port name as “test”
  4. There is a graphical interface for StressPrinters, but I prefer the command line interface. The following is an example showing a test of the HP Color LaserJect 2600n driver:

addprinter64.exe -name "StressTest" -driver "HP Color LaserJet 2600n" -conc 5 -iter 10 -delay 500 -port "test"

To test a different print driver simply replace the text "HP Color LaserJet 2600n" with the exact print driver name as displayed within Print Management.

The symptoms of a failed stress test are one or more of the following:

  • The stress test hangs
  • The Print Spooler crashes
  • Interactive Services Detection pop-ups

Note that a successful test may still show warning as shown below:

If a print driver fails the stress test go back to the vendor's web site and hunt around for an alternative driver and try again. While this process does take some time to complete, the resulting stable XenApp farm is worth the effort.

22 June 2011

Recommended XenApp 6 Hotfixes

I am a huge fan of XenApp 6, but XenApp 6 does have more than it's fair share of bugs. While Citrix have published a list of recommended Citrix and Microsoft hotfixes, their list misses one critical Citrix hotfix ("040"). Here is my list of recommended XenApp 6 hotfixes to keep your farm (mostly) bug free:
For Microsoft hotfixes when running Windows 2008 Server R2 SP1, I recommend the following hotfixes:
I will try to keep this updated, but always check the XenApp 6 hotfix list and Citrix's recommended hotfixes to see if there are new hotfixes which apply to your environment.

1 June 2011

31 May 2011

Faulting module: svchost.exe_gpsvc

A Group Policy problem on XenApp servers is a high visibility issue so I was not happy to see this error in the system log:
The Group Policy Client service terminated unexpectedly. It has done this 1 time(s). The following corrective action will be taken in 120000 milliseconds: Restart the service.

And this error in the application log:
Faulting application name: svchost.exe_gpsvc, version: 6.1.7600.16385, time stamp: 0x4a5bc3c1
Faulting module name: ntdll.dll, version: 6.1.7600.16695, time stamp: 0x4cc7b325
Exception code: 0xc0000374
Faulting application path: C:\Windows\system32\svchost.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll

That is what a crash of the Group Policy service looks like, followed by page after page of GroupPolicy 1128 warnings in system log. I am a big fan of Windows Error Reporting (WER) as WER automatically creates a crash dump file when this type of error occurs which means rather than just googling the crash I can analysis the dump and (hopefully) see what caused the crash. In this case, the key info from the analysis is:
DEFAULT_BUCKET_ID: STATUS_HEAP_CORRUPTION
PROCESS_NAME: svchost.exe
ERROR_CODE: (NTSTATUS) 0xc0000374 - A heap has been corrupted.
MODULE_NAME: gpprefcl
IMAGE_NAME: gpprefcl.dll

Now I know the offending module is gpprefcl.dll I hit google looking for the most recent hotfix which updates this dll and I come up with KB2514376. I will test this over the coming weeks to see if it fixes the Group Policy service crash.

EDIT - 20 June 2011: The hotfix has not solved this issue and we have logged an incident with Microsoft

EDIT - 08 July 2011: We have installed KB982293 and KB2526870 and not seen this issue again..... yet.