XenApp 6.x Commands Reference

XenApp Commands Reference

Citrix XenApp commands provide an alternative method to using the console for maintaining and configuring servers and farms. Citrix XenApp commands must be run from a command prompt on a server running Citrix XenApp.

Command Description
acrcfg Configure auto-reconnect settings.
altaddr Specify server alternate IP address.
app Run application execution shell.
auditlog Generate server logon/logoff reports.
change client Change client device mapping.
chfarm Change the server farm membership of the server, create an additional farm, and configure a replacement data store.
ctxkeytool Generate farm key for IMA encryption.
ctxxmlss Change the Citrix XML Service port number.
dscheck Validate the integrity of the server farm data store.
dsmaint Maintain the server farm’s data store.
enablelb Enable load balancing for servers that fail health monitoring tests.
icaport Configure TCP/IP port number used by the ICA protocol on the server.
imaport Change IMA ports.
migratetosqlexpress Migrate the server farm’s data store from a Microsoft Access database to a SQL Server Express database.
query View information about server farms, processes, ICA sessions, and users.
twconfig Configure ICA display settings.

QUERY FARM

Use query to display information about server farms within the network.

Syntax

query farm [server [/addr | /app | /app appname | /load | /ltload]]
query farm [ /tcp ] [ /continue ]
query farm [ /app | /app appname | /disc | /load | /ltload | /lboff | /process]
query farm [/online | /online zonename]
query farm [/offline | /offline zonename]
query farm [/zone | /zone zonename]
query farm [/?]

Parameters

appname
The name of a published application.
server
The name of a server within the farm.
zonename
The name of a zone within the farm.

Options

farm
Displays information about servers within an IMA-based server farm. You can use qfarm as a shortened form of query farm.
server /addr
Displays address data for the specified server.
/app
Displays application names and server load information for all servers within the farm or for a specific server.
/app appname
Displays information for the specified application and server load information for all servers within the farm or for a specific server.
/continue
Do not pause after each page of output.
/disc
Displays disconnected session data for the farm.
/load
Displays server load information for all servers within the farm or for a specific server.
/ltload
Displays server load throttling information for all servers within the farm or for a specific server.
/lboff
Displays the names of the servers removed from load balancing by Health Monitoring & Recovery.
/process
Displays active processes for the farm.
/tcp
Displays TCP/IP data for the farm.
/online
Displays servers online within the farm and all zones. The data collectors are represented by the notation “D.”
/online zonename
Displays servers online within a specified zone. The data collectors are represented by the notation “D.”
/offline
Displays servers offline within the farm and all zones. The data collectors are represented by the notation “D.”
/offline zonename
Displays servers offline within a specified zone. The data collectors are represented by the notation “D.”
/zone
Displays all data collectors in all zones.
/zone zonename
Displays the data collector within a specified zone.
/?
Displays the syntax for the utility and information about the utility’s options.

Remarks

Query farm returns information for IMA-based servers within a server farm.

Security Restrictions

You must be a Citrix administrator to run query farm .

Information

This article contains examples of PowerShell script designed to launch XenApp commands and being able to perform data manipulation between commands in one script.

Requirements

  • Microsoft Windows Server 2008 R2
  • Citrix XenApp 6.0 or 6.5
  • Microsoft PowerShell

Background

In some cases administrators have the need to capture information from PowerShell and also manipulate it for other wrong commands. Many PowerShell commands can be combined together using pipes. For example: Get-XAApplication | Clear-XAApplicationLoadEvaluator

This command removes the load evaluator from each one of the applications.

In this one line command example, the administrator has no opportunity to see the data captured by the Get-XAApplication before it is used under the Clear-XAApplicationLoadEvaluator, this article contains examples of other ways to launch this command so there is space in between for some data manipulation or data reporting.

PowerShell Script Designed to Launch XenApp Commands

Following are two examples to understand PowerShell script designed to launch XenApp commands:

Example 1

Usage

The following PowerShell command reports each application name and removes its load evaluator.

Write-Host "Adding Citrix Powershell Snapin..."

Add-PSSnapin Citrix.XenApp.Commands

Write-Host "Checking applicatoon list and removing load evaluators."

ForEach ($App in Get-XAApplication)

{

        Clear-XAApplicationLoadEvaluator -BrowserName $App.BrowserName

}

Write-Host "Job Done, Have a Nice Day !!"

This script works the same as the preceding one line command. The data between the steps can be worked on in this approach. This method provides flexibility to report or validate with certain condition.

Example 2

Usage

The following PowerShell command reports each application name, removes its load evaluator, except on applications from the Microsoft Office Suite.

Write-Host "Adding Citrix Powershell Snapin..."

Add-PSSnapin Citrix.XenApp.Commands

$y = 0

Write-Host "Checking applicatoon list and removing load evaluators."

ForEach ($App in Get-XAApplication)

{

      if($App.DisplayName-notlike "*Microsoft*")

      {

        Clear-XAApplicationLoadEvaluator -BrowserName $App.BrowserName

   }

    else

   {

        $y += 1

   }

}

Write-Host "The load evaluator was not removed from $z application(s)."

Write-Host "Job Done, Have a Nice Day !!"

Adding extra steps to the script can verify each application name and validate if it contains the word Microsoft, if it exists load evaluator is not removed, if it does not exist the load evaluator for the application is cleared.

In certain areas of the script, code is added to write messages to the console, this is useful for farms that have a lot of applications. Using this message an administrator gets an idea that the script is running and the progress so far. Also this script contains a count result to report how many applications were not modified in total.

Conclusion

This article implies that the XenApp PowerShell commands are quite flexible, similar to the native commands existing in Windows PowerShell. Many tasks can be completed using the same logic. This can be used for monitoring, reporting, configurations, and so on. The one line commands as mentioned at the beginning of the article can be used, but to have all or most of your routines simplified or even automated this is a good approach. This helps reducing resources in routine and replacing it with higher priority tasks.

Additional Resources

Citrix Download – Citrix XenApp 6.0 SDK

Citrix Download – Citrix XenApp 6.5 SDKCTX126471 – How to Install and Enable XenApp 6.0 SDK

CTX126287 – How to Use Microsoft PowerShell with Configuration Logging to Export DataCTX126987 – How to Capture a CDF Trace with PowerShell in XenApp 6

Applicable Products

Citrix XenApp 6: 12 Command-Line Tools Worth Knowing

While managing your Citrix XenApp 6 farm from the comfort of the Citrix Delivery Services Console GUI tool is a very powerful thing, you should know that XenApp 6 also has a subset of command-line tools that are at your disposal and can help with advanced farm management and troubleshooting:

1. Altaddr: If you’re a Citrix old timer, you probably remember using this tool before secure gateway was available, in order to extend the published applications to users outside the secure network. In essence, what Altaddr allows you to do is give your XenApp server an alternate IP address. Traditionally this was an outside facing public IP address or some kind of a NAT. Of course, the down side is if you have 100 XenApp servers, you would need 100 public IP addresses. Altaddr is not in use or popular anymore, but it is still there if you have the distinct situation where it makes sense.

2. App: Typically used for scripting or customizing an application’s behavior. You can use App in your scripts to control the application’s environment or to satisfy its prerequisites before the application runs.

3. Auditlog: A handy utility that, for the most part, dumps the security event log from Windows and allows you to pipe that log into a text file. You can use the output to audit who logged in or out of the server and when. This could come in handy if you are troubleshooting, for example, if your print service crashes; you can see who logged in during that time and if they are mapping a bad driver, etc.

4. Change client: Allows you to change the client device mappings in an ICA session, LOT, COM, USB mappings. etc.

5. Ctxkeytool: You can use this utility to generate an encryption key that can be used when enabling IMA encrypted communication in the Citrix farm.

6. Ctxxmlss: This handy little utility allows you to modify the XML port on the XenApp servers should you need to change that port for any reason.

7. Dscheck: I use this tool frequently to check for consistency on the Citrix IMA data store. It is particularly handy in conjunction with the /clean switch, which you would use to clear out any inconsistencies in the database.

8. Dsmaint: All interaction with your data store can be manipulated using this tool. For example, if you want to change data store database servers, you can use Dsmaint to do so. You can also use it to verify the local host cache on the XenApp server. The Local Host Cache or LHC is a subset of the data store database that runs on each XenApp server. Sometimes, as a troubleshooting step, you may want to verify the accuracy of that data or even refresh it altogether.

9. Enablelb: This utility restores XenApp servers into the load balancing mix after they have failed Citrix health monitoring tests.

10. Icaport: Here’s a too that allows you to change the default port that the ICA protocol typically runs on.

11. Imaport: allows you to change the default port that the IMA protocol runs on

12. Query: Arguably the most useful command-line tool, I use the query command for troubleshooting, for verifying load on the server, for just about anything administration related. If I need to know, I always start with the query command. It has a subset of values:

  • Query Farm or QFARM returns information on the XenApp servers in the farm and which one is a data collector
  • Query Session returns information about the sessions that are running on the XenApp server
  • Query Process will return the all the running processes on the server
  • Query User or QUSER returns information about all the users on the server

All these tools are available to you with the default installation of XenApp 6. However, as you can see from the list above, the number of Citrix XenApp 6 command-line tools has been shrinking with each new version and that is not because of insufficient development. Instead, it’s because Citrix is kind of following the Microsoft lead and porting most of its command-line tools to PowerShell. Event so, XenApp 6 has a very rich PowerShell footprint, wihich I plan to explore more in future blogs.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s