I had to create a script to backup the Citrix policies, in order to do this I had to use the Citrix.GroupPolicy.Commands.psm1. Before I could use them I had to install the XenApp SDK, because I had to run this script from every Citrix XA server I wanted to create an unattended install of the SDK. I added a zipfile with the extracted XASD60.exe here.
To install the SDK unattended you case use the following command line:
msiexec /i %systemdrive%:\XASDK60
\XASDK6.0\Se tup\Citrix.C ommon.Comman ds.Install_x 64.msi /qn
msiexec /i %systemdrive%\XASDK60\XASDK6.0\Se tup\Citrix.X enApp.Comman ds.Install_x 64.msi /qn
msiexec /i %systemdrive%\XASDK60\XASDK6.0\Se tup\Citrix.X enApp.Server .SDK_x64.msi /qn
msiexec /i %systemdrive%\XASDK60\XASDK6.0\Se tup\XenAppGp mx_x64.msi /qn
After the installation of the SDK you should import the Citrix.GroupPolicy.Commands.psm1 by using:
# Set execution Policy
Set-ExecutionPolicy Unrestricted -force
#Import Module
Import-Module “C:\xenapp 6.5\Citrix.GroupPolicy.Commands.psm1”
Based on the way you arranged your policies you can choose the way you backup your policies as stated in CTX128625
Exporting from IMA Datastore Farm Policy
Unless a PowerShell drive is specified, the Export-CtxGroupPolicy cmdlet defaults the the IMA Datastore Farm Policy. To export from the IMA Datastore run the command:
Export-CtxGroupPolicy <PathToExportFolder>
Importing to IMA Datastore Farm Policy
Unless a PowerShell drive is specified, the Import-CtxGroupPolicy cmdlet defaults the the IMA Datastore Farm Policy. To export from the IMA Datastore run the command:
Import-CtxGroupPolicy <PathToExportFolder>
Exporting from Local Server Policy
Unless a PowerShell drive is specified, the Export-CtxGroupPolicy cmdlet defaults the the IMA Datastore Farm Policy. To export from the local server policy run the command:
Export-CtxGroupPolicy –DriveName localgpo <PathToExportFolder>
Importing to Local Server Policy
Unless a PowerShell drive is specified, the Import-CtxGroupPolicy cmdlet defaults the the IMA Datastore Farm Policy. To import to the local server policy, run the command:
Import-CtxGroupPolicy <PathToExportFolder> –DriveName localgpo
Exporting from Active Directory GPO
- Associate a new PowerShell drive to the GPO to be exported. In this example, replace <DomainGpoDrv> with the name of the new PowerShell drive being created and replace <DomainGPO> with the name of the GPO being exported.
New-PSDrive -Name <DomainGpoDrv> -PSProvider CitrixGroupPolicy –Root \ -DomainGpo <DomainGPO>
- Export the GPO to a folder:
Export-CtxGroupPolicy -DriveName <DomainGPODrv> <PathToExportFolder>Importing to Active Directory GPO
- Associate a new PowerShell drive to the GPO to be exported. In this example, replace <DomainGpoDrv> with the name of the new PowerShell drive being created and replace <DomainGPO> with the name of the GPO being exported. Note: The target GPO must already exist in the Active Directory domain.
New-PSDrive -Name <DomainGpoDrv> -PSProvider CitrixGroupPolicy –Root \ -DomainGpo <DomainGPO>- Import the GPO from a folder:
Import-CtxGroupPolicy <PathToExportFolder> -DriveName <DomainGPODrv>
# Set execution Policy
Set-ExecutionPolicy Unrestricted -force
#Import Module
Import-Module “C:\xenapp 6.5\Citrix.GroupPolicy.Commands.psm1”
#Backup policy
Export-CtxGroupPolicy “C:\xenapp 6.5\backup”
Kees Baggerman
Latest posts by Kees Baggerman (see all)
- Nutanix AHV and Citrix MCS: Adding a persistent disk via Powershell – v2 - November 19, 2019
- Recovering a Protection Domain snapshot to a VM - September 13, 2019
- Checking power settings on VMs using powershell - September 11, 2019
- Updated: VM Reporting Script for Nutanix with Powershell - July 3, 2019
- Updated (again!): VM Reporting Script for Nutanix AHV/vSphere with Powershell - June 17, 2019