Brian Madden Logo
Your independent source for application and desktop virtualization.
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 16 Replies | 1 Follower

Top 200 Contributor
Points 1,095
Josef Zeiler Posted: Thu, May 4 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
Guest replied on Tue, Aug 1 2006 9:15 PM
I am looking for same thing, have you found any thing that could help???

MB
  • | Post Points: 5
Guest replied on Tue, Mar 27 2007 3:29 AM
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 48,501
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. [:(]

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 48,501
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.

Why is it called "Common Sense"? It doesn't seem all that common!

  • | Post Points: 20
Top 50 Contributor
Points 5,427
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 48,501
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

Why is it called "Common Sense"? It doesn't seem all that common!

  • | Post Points: 20
Top 50 Contributor
Points 5,427
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 48,501
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

Why is it called "Common Sense"? It doesn't seem all that common!

  • | Post Points: 20
Not Ranked
Points 50
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 48,501
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.

Why is it called "Common Sense"? It doesn't seem all that common!

  • | Post Points: 20
Not Ranked
Points 50
But knowing that, I can make sure none of them do! LOL
  • | Post Points: 5
Top 10 Contributor
Points 24,510
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

VCIT website My Blog

  • | Post Points: 20
Not Ranked
Points 150
I wrote a tool to backup/restore or import/export policies between farms (I need to move 464 policies from 4.0 farm to 4.5 farm).

I tried to run the backup script created by Mark on my 4.0 farm and fails, I review the code and made a couple of changes and still fails... so I check my code and found some code to export session printers I wrote in June 2008, I took some pieces of code from Mark scripts (I loved the XML file option...my old code used a TXT file) and review MFCOM guide and got more code from there.

The free tool is available at http://ctxadmtools.musumeci.com.ar

Ctx Policies Manager backup/restore/migrate Citrix Presentation Server 4.0 and Citrix XenApp 4.5 farms. I backup policies in both Citrix Presentation Server 4.0 and Citrix XenApp 4.5 farms and restore successfully in the Citrix XenApp 5.0 farm. Backup/Restore/Migration between Citrix XenApp 5.0 farms is not fully supported in this version.

Guillermo Musumeci
Windows Infrastructure Architect
CCA, CCEA, MCSE, MCSD, MCDBA, MCITP, VCP

http://ctxadmtools.musumeci.com.ar

 

  • | Post Points: 20
Page 1 of 2 (17 items) 1 2 Next > | RSS