Remote Assistance PowerShell GUI for XenApp

Shadowing to or from multi-monitor desktops is broken in Windows Server 2008 R2, which means Citrix XenApp 6.x. Nothing new here, I read about this on Joshua Mueller’s blog about a year ago, and Citrix also has an article based on explaining how to use Microsoft Remote Assistance as alternative shadowing method.

While RA is a good alternative the problem is that there is no integration with the XenApp farm; a support person must find the user session within the XenApp console, find the XenApp server the session is on, open RA using msra.exe /offerra, enter the server name and finally select the user session from the drop-down list. Phew. A few too many steps for support staff who do this day-in day-out.

Surely there must be a better way! There is, but it’s not perfect either. I had some fun using Sapien PrimalForms CE to create a PowerShell GUI which helps automate the task of finding a XenApp user session and shadowing the user via Remote Assistance. To find the free version of PrimalForms go to downloads, sign up, and look in the Community Tools section for the free download.

Here is a quick overview of the script:
Run the script RemoteAssistance.ps1 from a XenApp server and you will be prompted for a username, enter a username and hit search and all the user’s sessions will be listed:

Select a session, hit Connect and Remote Assistance will open and connect to the XenApp server.

Select the user from the drop-down list and click Next to shadow the session.

Hold on. If you can automatically connect to the server, surely you can also connect straight to the user session and eliminate this last step? Right? Simple? No. Please, someone tell me I have missed something simple and there is a way to make Remote Assistance connect to the server and the session. All the script is doing is passing arguments to msra.exe, and these are the options msra.exe excepts:

Yes there is a argument, but no argument 🙁

So this Remote Assistance GUI is helpful, but far from perfect. Please let me know if you find it useful, would like it modified, or know of another way of invoking a Remote Assistance session where the username can be parsed.

The script can be published in XenApp using this command line:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -File “\\server\share\RemoteAssistance.ps1”

Download the script from here.


  1. Anonymous says:

    Hi Jason,

    very cool stuff 🙂
    Could you please provide the PrimalForms (.pff) project file too?
    Thx in Advance
    a powershell guy from germany

  2. Peter says:

    Parsing to the user with msra seems to be impossible but this script i good enough i think. Could you send me the .pff file? I would appreciate that very much.

    Best Regards

  3. That is great Jason, nice work. It is possible to get the project file as I would like to change the size of the blue window slightly as I want to add some extra wording in there.

  4. Anonymous says:

    When I use on the Xenapp 6, and search I still get this message:

    Cannot index into a null array.
    At C:Test.ps1:48 char:3
    + Write-Host (“Selected session: ” + $serverSessions[$selectedSession].
    BrowserNa …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

    Cannot index into a null array.
    At C:Test.ps1:52 char:3
    + $Arguments = (“/offerra ” + $serverSessions[$selectedSession].ServerN
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

    Exception calling “Start” with “1” argument(s): “Het systeem kan het opgegeven
    bestand niet vinden”
    At C:Test.ps1:56 char:3
    + $Process = [System.Diagnostics.Process]::Start($Pr
    ocessStar …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : Win32Exception

    Have some this problem also on his environment

  5. Anonymous says:

    Great Scritp thanks!
    Which Permissions (for support Personal) are needed to find any sessions?

  6. Unknown says:

    Is this the only way to publish the script? is there a way to push it without pointing it to a network share?

  7. OpenIT says:

    Great script. I want to give my helpdesk users this nifty tool but my helpdesk users don’t see any ICA sessions, only RDP sessions while administrator user see all sessions.
    I dig a bit and found the my problem is in this line:

    et-XASession -Farm | where { $_.AccountName -like (“*$userName”) -AND $_.State -eq “Active”}

    helpdesk user doesn’t get any result.
    any idea?


  8. Nik Stapley says:

    Hi Jason, great work but we are also having the same issue whereby it only seems to enumerate the users if you are a Full Citrix admin, the helpdesk who have full read rights, plus some extra bits, can’t seem to search for the users, any ideas?

    • Just checking the script and the code to obtain the list of sessions is:
      Get-XASession -Farm | where { $_.AccountName -like (“*$userName”) -AND $_.State -eq “Active”}

      To do some testing you can run Powershell as a helpdesk user on a XenApp controller (runas) and run:
      Add-PSSnapin Citrix.XenApp.Commands
      Then run the the following but substitute *$username with userdomainusername:
      Get-XASession -Farm | where { $_.AccountName -like (“*$userName”) -AND $_.State -eq “Active”}

      For example:
      Get-XASession -Farm | where { $_.AccountName -like (“deptivejason.poyner”) -AND $_.State -eq “Active”}

      Disclaimer: the above info all given with zero testing 🙂

  9. Jonathan says:

    Wow very clever idea. Thanks for sharing!

  10. Guido says:

    There is a hotfix available which will add a new parameter to msra.exe.

  11. robin says:

    when I launch the script from a published app following your instructions no app pops up. I see the citrix receiver loading the app but then no app appears

  12. Dean Alger says:

    Got the script working great, but would like to add a request.

    Can you add the functionality to KILL the users session? That would make this a perfect help desk tool.

  13. […] use this great script for remote assistance on a Citrix Farm , however it does not work with 7 out of the box , to get […]

  14. Munvar says:

    when I try to connect the session an error “your offer to help could not be set” check the following
    .Do you have the correct permissions on the remote computer?
    .Is the remote computer turned on, and is it connected to the network?
    .Is there a network problem?

    all the above check are good, still unable to use remote assistance. please advice.

Leave a Reply

Contact Deptive

Deptive - Commercial Bay
11-19 Customs Street West St
Commercial Bay Tower, Level 17, Room 1715
Auckland 1010
We also have a virtual office in Wellington.

Contact Details

0800 000 141

Postal Address
PO Box 34797,
Birkenhead, Auckland 0746