XenDesktop create Catalog

454 Views Asked by At

Hi I'm using a script made by me and I try to use it to create a catalog in XenDesktop. And I don't know what is the error, really the XD answer say me that the error is to made 'random' the catalog, but, writing it there isn't any error.

I left the code

#
# CrearCatalogo.ps1
#

#Coger variables
[CmdletBinding()]
Param(
  [Parameter(Mandatory=$True,Position=1)]
   [string]$nombreCatalogo,
        [Parameter(Mandatory=$True)]
   [string]$tipoCatalogo,
        [Parameter(Mandatory=$True)]
   [string]$PVD
)

#Lanzar orden
$result = New-BrokerCatalog -name '$nombreCatalogo' -AllocationType '$tipoCatalogo' -MachinesArePhysical $false -ProvisioningType 'MCS' -SessionSupport 'SingleSession' -PersistUserChanges '$PVD' -AdminAddress "localhost:80"

   #Parsear

Now the error message (-AllocationType is the clue??)

New-BrokerCatalog : No se puede enlazar el parámetro 'AllocationType'. No se pu ede convertir el valor "$tipoCatalogo" al tipo "Citrix.Broker.Admin.SDK.Allocat ionType" porque hay valores no válidos en la enumeración. Especifique uno de lo s valores de enumeración siguientes e inténtelo de nuevo. Los valores de enumer ación posibles son "Permanent, Static, Random". En C:\scripts\CrearGrupoEscritorios\01CrearCatalogo.ps1: 17 Carácter: 68 + $result = New-BrokerCatalog -name '$nombreCatalogo' -AllocationType <<<< '$t ipoCatalogo' -MachinesArePhysical $false -ProvisioningType 'MCS' -SessionSuppor t 'SingleSession' -PersistUserChanges '$PVD' -AdminAddress "localhost:80" + CategoryInfo : InvalidArgument: (:) [New-BrokerCatalog], Parame terBindingException

Thanks

1

There are 1 best solutions below

0
On

OK, I investigate this days and this is the solution

#Coger variables
[CmdletBinding()]
Param(
  [Parameter(Mandatory=$True,Position=1)]
   [string]$nombreCatalogo,
    [Parameter(Mandatory=$True)]
   [Citrix.Broker.Admin.SDK.AllocationType]$tipoCatalogo,
    [Parameter(Mandatory=$True)]
   [string]$PVD
)

#Lanzar orden
New-BrokerCatalog –name "$nombreCatalogo" -AllocationType "$tipoCatalogo" –MachinesArePhysical $false –ProvisioningType 'MCS' –SessionSupport 'SingleSession' –PersistUserChanges "$PVD" -AdminAddress "localhost:80"

#Parsear 

First change $tipoCatalogo class from string to Citrix.Broker.Admin.SDK.AllocationType and change ' to " in variables in the script command. And finally delete $result variable

Thanks for reading