Friday 12 November 2010

Publishing explorer.exe in XenApp 6

Publishing windows explorer is something that I never thought was a good idea – but some people seem to like it!  It is to be fair a nice, simple alternative a published desktop if people want to just open their documents and then double click on a file.

Its supposed to just be a case of publishing a Hosted application shortcut to c:\windows\explorer.exe, with a parameter of the drive letter or path you want it to default to, like this to start in the h: drive:

image

It should be that simple.  But it isn’t.  By default this will only stay open if there is another program keeping the session open – if it is launched first (which it would be, logically) it closes after an instant. 

There is a registry fix from Citrix support though for this, which I found on this forum post: http://forums.citrix.com/message.jspa?messageID=1461520.

Create a DWORD (32 bit) setting called LogoffCheckerStartupDelayInSeconds with the value 10 at this location:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell\TWI

If you want a reg file to just import to fix this, copy the following text into a text file and save it with a .reg extension:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell\TWI]
"LogoffCheckerStartupDelayInSeconds"=dword:00000010

Wednesday 10 November 2010

Fixing session reconnect in XenApp 6

Something I had noticed on a XenApp 6 farm I have running with a small number of servers recently was that the sessions were not reconnecting properly, especially when they had been created from different workstations.  This is an issue for us as our users tend to move about, and the ability to migrate sessions is important.  Disconnected sessions also needlessly take up memory on servers.

At first I thought this was just an occasional issue, then I found I could reproduce it by opening an application using the Online Plug-in (the Agent!), then selecting “Disconnect Online Sessions”, then “Reconnect Online Sessions”.  This should obviously give me my sessions back, instead I got the message “There are no sessions available for reconnection”.

image

This may have been made worse by our using Passthrough Authentication.  Anyway, I checked the web interface cluster and it had lots of this error for all the servers:

Event ID: 30105

Event Description:

Site path: C:\inetpub\wwwroot\Citrix\PNAgent.

The Citrix servers do not trust the server. This message was reported from the XML Service at address http://xensvr02:80 [com.citrix.xml.NFuseProtocol.RequestReconnectSessionData]. 

This is something I remember fixing in Citrix Presentation Server v4.0, only of course the setting in XenApp 6 has moved.

In the Delivery Services Console, I selected Policies, the Computer tab, and the Unfiltered policy, which in my case is still the only policy.  I selected this policy, clicked edit and Next.

First, I checked that Auto Client Reconnect was set to “Allowed”, though since this is the default setting I doubt that made any difference.  Just to be sure I set it to Allowed and clicked OK.

image 

The important setting though is the XML service.  Scroll down the list on the left to XML Service and select the policy “Trust XML Requests”.  Click Add and set the policy to Enabled.

image

The other policy setting – XML Service Port – does not need configuring get this functionality working.

I then ran gpupdate on the servers with disconnected sessions and attempted to reconnect – this worked immediately.

I’m not sure why the default configuration for XenApp 6 appears to be for session reconnection to be essentially broken, at least for users with the Online Plug-in and Passthrough Authentication.  I also have not made any attempt to make sure that “only trusted services communicate with the Citrix XML Service”.  I am assuming here that this would involve making sure only our Web Interface servers could communicate with the XML Service using firewall rules, so that might be something to consider next time we review our firewall policies.

This page does appear to confirm that this is the correct fix for a system with Passthrough Authentication clients who want session roaming…

http://support.citrix.com/proddocs/index.jsp?topic=/xenapp6-w2k8-admin/ps-sf-citrix-xml-service-port-set-v2.html

Monday 8 November 2010

Citrix Online and Offline plug-ins updated

Citrix have been quietly updating things again over the last couple of months – this mainly appears to be an exercise in bug fixing from the original XenApp 6 release!

Citrix Online Plug-in 12.1

I still call it the “Citrix Agent” y’know.

Anyway, v12.1 has finally been released and can be downloaded from here:

http://support.citrix.com/article/CTX126965

It boasts a staggering 72 fixes to the previous versions which has got to make it an important release.  The most important fix from my point of view is the end of the bug introduced in at least v11.2 which caused clipping to occur when shadowing users on apparently any version of Citrix farm.  Previously I have been downgrading helpdesk users to v11.0 which usually fixed it, it is nice to have that problem removed.

New features of the client include

  • ICA file signing. Apparently our security is increased by this change.
  • The client end of the new XenApp Printing Optimization Pack.  There is a corresponding update for the XenApp 6 servers as well – this should improve printing for clients using v12.1 connecting to servers with the hotfix XA600W2K8R2X64010 installed.  Personally I am about to start testing to determine whether its worth updating ALL our servers and clients to get this or just let it creep in.
  • A new decoder for HDX 3D Pro Graphics, which apparently is something for XenDesktop - this explains why I have never heard of it before.

I think the 72 bug fixes are probably the big win here!

Citrix Offline Plug-in 6.0.1

And I still call this the “Streaming Client”…

Whatever it is called, it was updated last month and can be downloaded from here: http://support.citrix.com/article/CTX125480

The good news for those with lots of application streams is that there is no new Streaming Profiler, version 6.0 is still current, so we should not have to recreate or update everything.  Again.

Anyway, for an upgrade of one minor point version – 6.0.0 to 6.0.1 – it has a LOT of stuff in the Issues Fixed list – 45 at the moment, and I am sure this has gone up as well since they released it.  Worrying issues this release fixes include scenarios where the XenApp servers could experience a blue screen of death crash (nice!) and a really annoying bug in streaming Microsoft Office where fonts fail to load.  I’m fairly sure I spent some time trying to fix this before it became one of the many reasons I wrote off streaming Office 2010 to servers in this release and went Hosted instead.

There is still stuff in the Known Issues for the Offline plug-in, including incompatibility with UPM v3.1.0.86 (just upgrade to 3.2…) and an odd couple of issues if you uninstall the client, the fix for one of them being to run a Repair on XenApp itself. 

So anyway, both client upgrades look like being a really good idea, fixing a phenomenal 117 issues between them.

Friday 5 November 2010

Notes on PowerShell in XenApp 6

Powershell v2 comes installed by default on Windows Server 2008 R2.  Citrix have followed Microsoft’s example with products such as Exchange in providing a fairly thorough set of commands in Powershell to monitor and administer the farm.  And with the loss of MFCOM as a way of command line farm administration, its become an essential skill.  Personally I have no real need at the moment to use Powershell for actions such as publishing applications as our environment is still small enough to be faster to administer with the Delivery Services Console, but for any mass change to the farm the command line will become far faster and for monitoring, its great.
To easily be able to use PowerShell to administer XenApp 6, first you need to download and install the SDK.  And I like to have my admin tools as published apps, so this is how to create a XenApp 6 PowerShell based management application as a hosted application on your farm:
Publishing the PowerShell console with XenApp commands
  • Download the XenApp Powershell SDK : http://community.citrix.com/display/xa/XenApp+6+PowerShell+SDK
  • Extract and execute the installer
  • Agree to change the execution level to AllSigned
  • Publish an application to this server with the following location:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoExit -File "c:\Program Files\Citrix\XenApp Server SDK\Citrix.XenApp.Sdk.ps1"
  • Launch your new editor
  • By default it will not be set up to recognise XenApp commands while editing, so use the command:
    Add-PSSnapin Citrix*

    image 
Publishing the PowerShell ISE Editor
You can use Notepad to edit your PowerShell scripts – but that’s not very fun so let’s publish an application “Windows PowerShell Integrated Scripting Environment (ISE)”. This is a very good editor for developing PowerShell scripts, with a nice window to run them in and some basics like automatic colouring of your code.  Of course, you can skip this if you like Notepad…
  • Login to your XenApp 6 server
  • Go to Command Prompt
  • Enter this command: 
    servermanagercmd -install PowerShell-ISE
  • It will whinge and then work anyway:
    image
  • Publish a hosted application on your farm at:
    c:\windows\sysWOW64\WindowsPowerShell\v1.0\PowerShell_ISE.exe
  • Again, you will need to run the command “Add-PSSnapin Citrix*” to preload all the commands for XenApp.  In ISE, you can enter quick commands like this in the bottom window, then build up your scripts in the tabbed top window.  The middle window displays any console output.
image 
Some useful basic commands for XenApp in PowerShell
I’m planning a much bigger post on this, but in the meantime, here’s some really basic bits of code to show you what you can do with PowerShell…
Display the farm name
$farm = Get-XAFarm   
$farm.FarmName
Display the zone name data collector for a zone (the zone of the XenApp server you run on of course)
$zone = get-XAzone
$zone.ZoneName
$zone.DataCollector
Display counts for the total number of active and disconnected sessions in the farm
Get-XASession -Farm | where-object {$_.State -eq "Active" } | Measure-object
Get-XASession -Farm | where-object {$_.State -eq "Disconnected" } | Measure-object
Display a list of all your farm servers, listed alphabetically, with the number of sessions on each:
$servers = Get-XAServer -full   
$output = "`nServers: `n"
    foreach($server in $servers | sort-object ServerName){
        $output+=$server.ServerName + "  " + $server.SessionCount + "`n"
    }
$output
Remember if you are saving any of these its best to put the command “Add-PSSnapin Citrix*” at the top to make sure it always has the Citrix commands loaded.  You should really consider signing your scripts as well – which is an art in itself!