In an earlier article I already described two freeware tools which made it possible to export the Citrix configuration into a format usable for documentation purposes. There are also nice tools available to export your Published Application settings, so in a case of a mistake or a failure your applications configuration could be restored quickly. Unfortunate no comparable functionality was available for back-up and restores Citrix policies. Till December 2007 when Mark Elliott released his VB scripts.
As the introduction already implies the utility is just a set of two VB scripts, so no installation is required. Just copy the two files to one of your Citrix servers.
Back-up the Citrix Policies
For creating the back-up you need to logically named script called BackupPolicy.vbs. This VBS file need to be started using the cscript executable and has two possible parameters. Using the -? Parameter you view the parameters with their possible values.
During back-up you can specify the level of information (-lo:[0,1,2,3]) displayed during the back-up and the name of the file (-file:<FileName>) the policy settings should be stored.
If do not specify any parameters the script will use the default settings for level and creates the file using the convention <FarmName>-policies.xml.
All policies available on the datastore will be saved in one single XML file. Personally I would love to see the option to specify an option to store each policy in a separate file, because this makes versioning easier.
Restoring Citrix Policies
When it is necessary to restore a policy the second VB script is necessary. This one is called RestorePolicy.vbs (what a surprise). This VBS script has some more optional parameters.
Again the log (-lo:[0,1,2,3]) is available for specifying the amount of information showed during the running of the script. The following parameter -pf:x specifies if you would like to import the policy filter on the policy. Default is 1 for restoring the filter or a 0 for restoring the policy without the filter. Restoring without the filter can be useful if you add the policy to another Farm (for example as a kind of template).
With -po:[0,10 you can specify if the policy need to be overwritten if the policy already exists. By default the script does not overwrite a policy if it is already available, so remember to specify this parameter if the policy is still there but a configuration error is available inside the policy.
The script makes it possible to specify which policies should be restored by specifying the parameter -policies:[Policy Names]. You can specify more policies by separating them with a comma between quotation marks. Tip: the exact name of the policy can be found in the XML file. If you do not specify all the policies are restored (depending of the overwrite parameter of course).
The last logical parameter is specifying the name of the file in which the policy/policies are stored. When all the parameters are set, you are ready to restore the (specified) policies.
Kudos goes to Mark Elliott. This is definitely a real value adding freeware tool. It is really useful as a back-up mechanism, but can also be used to transport policies to one farm to another during a migration phase or build a template which you can use as a starting point at your customers during the build phase. With the possibility to back-up each policy in its own file (for better version control) the tool would be perfect in my opinion.