Friday, January 27, 2012

Where are the XenApp 6.5 PowerShell commands? Why can’t I execute them in PowerShell?

Problem

You’re trying to use the Citrix XenApp 6.x PowerShell commands such as Get-XAAplication from your XenApp 6.5 server’s Windows PowerShell with Citrix XenApp Migration Module (x86)

Start –> Administrative Tools –> Citrix –> XenApp Migration –> Windows PowerShell with Citrix XenApp Migration Module (x86)

image

image

image

… but receive the following error:

PS C:\Users\a-tluk> Get-XAApplication
The term ‘Get-XAApplication’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:18
+ Get-XAApplication <<<<
       + CategoryInfo                   : ObjectNotFound: (Get-XAApplication:String) [], CommandNotFoundException
       + FullyQualifiedErrorID       : CommandNotFoundException

image

You also tried adding the Add-PSSnapIn Citrix.XenApp command but the the command prompt says the Citrix modules have already been added.

Solution

I found it strange that while the Citrix modules were loaded in the Windows PowerShell with Citrix XenApp Migration Module (x86) command prompt, not all of the modules were.  My guess is that this prompt only loads the additional XenApp Migration Module commands.

What we should do to get the additional Citrix XenApp PowerShell commands is to either start the Windows PowerShell Modules command prompt as an administrator from:

Start –> All Programs –> Administrative Tools –> Windows PowerShell Modules

image

Once the window launches, you’ll immediately see the Citrix snap-ins added:

image

Once the snap-ins are loaded, try typing Get-XA and then the tab key:

image

image

If the command gets auto completed with a XenApp command, you know you’re on your way.

What I noticed was that if you just launch PowerShell from the pinned icon in the taskbar, you need to run the Add-PSSnapIn Citrix.XenApp.Commands command to get the XenApp cmdlets because the window that launches does not show the citrix modules being loaded:

image

image

image

I know this looks simple but I’ve been asked a few times about this and I can see why it can get confusing.

1 comment:

Alex said...

So what happens if the command doesn't get auto completed and fails?