Brian Madden Logo
Your independent source for application and desktop virtualization.
Marketplace

advertisement

Has anyone a tool for importing/exporting Citrix Policies available?, in the Scripting / Automation forum on BrianMadden.com

rated by 0 users
This post has 14 Replies | 0 Followers

Top 150 Contributor
Points 1,090
Josef Zeiler Posted: 05-04-2006 5:12 AM
Hi all,

I would like to export/backup my set of policies I created in Citrix PS 4.0 CMC. I see that there are MFCOM functions available for manipulating Citrix policies, and an example called PolicyADM for displaying and manipulating policies. But I see no way to save a policy and re-import in another farm?

Has anyone of you ever seen a tool like this?

Regards Josef
  • | Post Points: 50
I am looking for same thing, have you found any thing that could help???

MB
  • | Post Points: 5
Me, too - has anyone found a tool to import and export citrix policies? If you have can you please email me at citrixint@gmail.com Thanks
  • | Post Points: 20
Top 10 Contributor
Points 26,630
I have mentioned in the past that I have been working on scripts to do just this. Unfortunately, I have not time to work on this recently. I have completed an EXPORT script, but have yet to do much work on the IMPORT side. Sorry folks. [:(]
DON'T FORGET TO VOTE!!!

Why is it called "Common Sense"? It doesn't seem all that common!
  • | Post Points: 20
Top 500 Contributor
Points 600
Dan, any luck on getting an import/export script to work for citrix policies? It seems like no one on the planet has a working script that can do this.
  • | Post Points: 20
Top 10 Contributor
Points 26,630
I haven't had much time to work on the Import side. The Export seems to be working fine, though. It's only half a solution at the moment. As you might expect, it's not a trivial thing to do.
DON'T FORGET TO VOTE!!!

Why is it called "Common Sense"? It doesn't seem all that common!
  • | Post Points: 20
Top 50 Contributor
Points 4,747
Dan, I've got a script which does both (import and export) which works for PS 4.0 and 4.5. Unfortunately I can't really release it (it's my company's intellectual property) but I'm more than happy to help you with any bits you get stuck on.
My backup script exported all the policies to an XML file then the restore script uses this XML file to recreate the policies. I've also added some command line arguments to make it a bit more useful. eg you have the option to overwrite or skip a policy if it already exists, there are 4 different logging levels, the option to restore or skip the policy filters, the option to only restore a specific set of policies, and the ability to specify the name of the XML file to use).

The only bug that I couldn't work around was the TWAINRedirectionRule setting in PS 4.0 so if you have this setting set then it will need to be added manually. This is fixed in 4.5.
  • | Post Points: 20
Top 10 Contributor
Points 26,630
Mark,

I appreciate the offer. My script works in a slightly different manner, although the net result I think is the same. My script exports each policy into its own file, which I have called a Citrix Policy Object. That way, each one can be restored on its own, if need be. My command options include the ability to export either numeric data (which is the way the information is stored natively in the policies) or as text (which makes it MUCH easier to read). Also, I have an option to only export "unique" policy entry values, rather than the whole thing, since most policies only address one specific area and you don't alway want all the "Not Configured" pieces included. I find the text output has come in handy when trying to document the policies.

My biggest bottleneck right now is time. That, and trying to figure out how to handle the priority value that gets exported. I'm thinking I have to ignore that when trying to import it, since that priority might already exist.

Any suggestions you have around how to handle any of the mechanisms would be great!

Thanks in advance!

Dan
DON'T FORGET TO VOTE!!!

Why is it called "Common Sense"? It doesn't seem all that common!
  • | Post Points: 20
Top 50 Contributor
Points 4,747
Sounds like it will be a pretty neat script. I just use numeric data as I'm not intending it to be used for documentation (I have a .NET 2.0 app that handles documenting the farm).
With regards to policy priority I thought it would be too difficult to determine the policy prority if it wasn't the priority it was exported with. Therefore, when I restore, I just restore it to the priority it was when it was exported. If a policy already exists with that priority, it is dropped to a lower priority. This happens by default.
eg. If the following config was exported;

PolA - priority 1
PolB - priority 2
PolC - priority 3
PolD - priority 4

If PolB was deleted it would look like this;
PolA - priority 1
PolC - priority 2
PolD - priority 3

If PolB was restored PolC would drop to priority 3 and PolD would drop to priority 4.

There's no special coding required to do this and I think it's the most likely scenario when a policy needs to be restored.

  • | Post Points: 20
Top 10 Contributor
Points 26,630
Mark,

I didn't know priorities were handled like that. I would have thought if I tried to import/create a ppolicy with a priority that already existed it would error out. Good to know, thank you! if things ever slow down enough, I'll work on the import side.

One reason I took the approach of individual policy files was so that I could use one as a template, then create "clones" of it, then import them. It would then be possible to automate the cloning process for repetitive things.

Again, thanks for your input. It is greatly appreciated!

Dan
DON'T FORGET TO VOTE!!!

Why is it called "Common Sense"? It doesn't seem all that common!
  • | Post Points: 20
Not Ranked
Points 30
Dan -

Would your export tool work for PS 3.0. I have a client that is migrating to 4.5, and they want a clean migration. They have extensive policies with extensive settings, so even if I have to manually key in the new policies, it would be helpful to have all the settings on paper in fornt of me rather than in a zillion screen shots!

Ben
  • | Post Points: 20
Top 10 Contributor
Points 26,630
I just tried it, and it appears to blow up if the policy references the CD-ROM drive mapping, as this is handled differently in PS 4.0 and up. Sorry.
DON'T FORGET TO VOTE!!!

Why is it called "Common Sense"? It doesn't seem all that common!
  • | Post Points: 20
Not Ranked
Points 30
But knowing that, I can make sure none of them do! LOL
  • | Post Points: 5
Top 10 Contributor
Points 15,602
Hi,

I haven't actually read through this post completely, so sorry if I'm duplicating this link:

http://www.brianmadden.com/content/article/VB-Script-to-Backup--Restore-CPS-policies

Cheers,

Alan Osborne
President (MCSE, CCNA, VCP, CCA)
VCIT Consulting - Citrix/Terminal Services Remote Desktop Solutions for SMB
p: 604-288-7325
c: 778-836-8025
web: http://www.vcit.ca
blog: http://www.vcit.ca/wordpress

  • | Post Points: 5
Not Ranked
Points 10