Export and Import XenApp Published Resources with PowerShell

When creating a QA XenApp environment to mirror production or building a new XenApp farm publishing resources can be quite time consuming. The attached PowerShell script can help make that task incredibly easier. Using this PowerShell script you can export all of the published resources from an existing XenApp farm to a CSV file. Then open the CSV file for editing and make adjustments if needed.

If you are moving from XenApp 5 to XenApp 6 this script will also work for you. For XenApp 5 you would need to have the XenApp Commands CTP v3 installed and run the script when exporting with the -XA5 switch.

Application Types exported and imported:

ServerInstalled

ServerDesktop

Content

StreamedToServer

StreamedToClient

StreamedToClientOrInstalled

StreamedToClientOrStreamedToServer
Notes:

Content redirection is not included in export or import.

Audio settings are not currently exported or imported.

If CSV contains a server name that does not exist for resource(s) being imported, import for that resource will fail.
Small sample of the CSV. Top line being the header.

When importing the only parameter/ switch that should be used is -import
The parameters available for this script are:

-CSV                       Required Name of CSV file to import or export from/to

-XA5                       Only required for exporting from XenApp 5 using XenApp Commands CTP v3

-Import                   Include this parameter to import applications from CSV

-Export                   Include this parameter to export applications from CSV

-WorkerGroups        Include to export workergroups with published resources

-Servers                  Include to export servers with published resources

-Help                      Displays the help topic

Syntax:

XAApps.ps1 -CSV “c:\Test.csv” -Export -WorkerGroups -Servers

Exports published resources from local XenApp server to “C:\Test.csv” with both workergroups

and servers for each resource.

XAApps.ps1 -CSV “c:\Test.csv” -Export -WorkerGroups

Exports published resources from local XenApp server to “C:\Test.csv” with only workergroups

for each resource.

XAApps.ps1 -CSV “c:\Test.csv” -Export -Servers -XA5

Exports published resources from local XenApp 5 server to “C:\Test.csv” with only servers

for each resource.

XAApps.ps1 -CSV “c:\Test.csv” -Import

Imports published resources from “C:\Test.csv” to local XenApp server.

XAApps PowerShell script

Important note: Please use the default Microsoft Operating System PowerShell console to run the script. – Thanks to Robert in the comments for catching this.
This script is provided as is and without support. Feedback or questions welcome.