hello !
I have a problem to create Policies Citrix with Powershell..
I run this script:
#Script To Create a New Citrix Policy
Param($Server,$PolicyName,$PolicyDescription)
if(!$PolicyDescription) {$PolicyDescription=$PolicyName}
$type = [System.type]::GetTypeFromProgID("MetaframeCOM.MetaframeFarm",$Server)
$mfarm = [System.Activator]::CreateInstance($type)
$mfarm.Initialize(1)
$NewPolicy = $mfarm.CreatePolicy(19,$PolicyName,$PolicyDescription)
I get an error code:
Exception calling "CreateInstance" with "2" argument(s)
:"Value cannot be null.Parameter name:type"
At X:\aidecitrix.ps1:8 char:44
+ $farm = [System.Activator] :: CreateInstance <<<< ($type)
You cannot call a method on a null-valued expression.
At X:\aidecitrix.ps1:9 char:18
+ $farm.Initialize <<<< (1)
You cannot call a method on a null-valued expression.
At X:\aidecitrix.ps1:10 char:33
+ $NewPolicy = $mfarm.CreatePolicy <<<< (19,$PolicyName,$PolicyDescription)
And I copied your script :
$mfFarm = New-object -com "MetaframeCOM.MetaFrameFarm"
$mfFarm.Initialize(1)
$mfFarm.FarmName # will return the Farm Name, but that is it.
$mfFarm | gm # all the properties are there, but blank
# But none of the properties provide any info
$mfFarm.Admins # returns nothing
I get an error code:
New-Object : Cannot load COM type MetaframeCOM.MetaFrameFarm
...
I have conducted your audit:
http://support.citrix.com/article/CTX106303 but still does not work ..
I was wondering if should I install XenApp Server SDK and run Windows Powershell with Citrix or something else to do ...
thank you for your answer
christophe