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.

22 Comments

  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
    ame)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~
    + 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

    • Jason Poyner says:

      The code in the error is called when you click Connect, not when you click Search. Can you confirm what you are doing when this error occurs?

    • Unknown says:

      I was getting the same error message. It was a scope issue. I changed all references of $serverSessions to $script:serverSessions and the Connect button worked.

  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?

    • Jason Poyner says:

      You can place the script where ever you want. I recommend a network share so that you have a single central copy of the script. But you can put a copy on several XenApp servers if you wish.

  7. OpenIT says:

    Hi,
    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?

    10x

  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?

    • Jason Poyner says:

      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. http://support.microsoft.com/kb/2899749/en-us

  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 http://deptive.co.nz/remote-assistance-powershell-gui-for-xenapp/ 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.

    • Jason Poyner says:

      Do you get the same issue without using the script? IE, just run msra.exe /offer
      If you still get the issue then RA is not set up correctly. You’ll need to get RA working before the script can be used.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Deptive

Location
Level 13 (Regus)
92 Albert St
Auckland
We also have a virtual office in Wellington.

Contact Details

0800 000 141

Postal Address
PO Box 34797,
Birkenhead, Auckland 0746