There are times when you want to migrate a folder structure from one Citrix XenApp 6 farm to another. For instance, if you maintain separate test, quality assurance, and production farms and need to migrate folders and applications between the farms. Fortunately, this is super easy in XenApp 6 using PowerShell.
Note: before you get started, be sure to check out this post on how to install the Citrix XenApp 6 PowerShell Cmdlets.
Export Specified Folders
You can export your entire folder structure, or just certain parts of it. In the example below, I will export only the “Testing” folder (see the screen shot below).
Here is how to export just the “Testing” folder and its subfolders using PowerShell to a XML file called “TestingFolders.xml”:
Get-XAFolder -FolderPath "Applications/Testing" -Recurse | Export-Clixml c:\TestingFolders.xml
Well, the cool thing about PowerShell is that it is pretty readable, so I don’t think this command needs a lot of explanation. However, let’s look at the resulting XML file.
Applications/Testing/Microsoft Office Applications/Testing/Sales Applications/Testing/Utilities Applications/Testing/Utilities/Microsoft Applications/Testing/Utilities/Citrix
No rocket science there either. It is just a list of folders. You could easily hand craft one of these XML files to create a folder structure. What I am going to do here is modify the folder path so that the folders get created in the “Applications/QA” folder and then save the file as “QAfolders.xml”. Here is what the XML file looks like now:
Applications/QA/Microsoft Office Applications/QA/Sales Applications/QA/Utilities Applications/QA/Utilities/Microsoft Applications/QA/Utilities/Citrix
Now that you have your XML file, it is relatively easy to import. Here is how to do it:
Import-Clixml c:\QAFolders.xml | New-XAFolder
Here are the results:
So all this folder structure stuff is fine, but wouldn’t it be nice to import some apps into those folders? Of course it would. Here is how to export and import XenApp 6 published applications using PowerShell.