PrepareMethods.ps1
# # Citrix IPS prepare job support # function Get-ProvisioningType([string]$Platform, [psobject]$ConfigData, [hashtable]$Parameters, [bool]$Verbose) { $provisioningTypeVariableName = @{ ahv = '' # config file not supported aws = 'CloudProvisioningType' azure = 'CloudProvisioningType' gcp = 'CloudProvisioningType' vsphere = 'ProvisioningType' xen = '' # config file not supported } return Get-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName 'ProvisioningType' -ConfigParameterName $provisioningTypeVariableName[$Platform.ToLower()] -Verbose $Verbose } function Format-PrepareData([string]$Platform, [hashtable]$Parameters, [psobject]$ConfigData=$Null, [bool]$Verbose=$False) { $prepareData = Format-JobData -Platform $Platform -ConfigData $ConfigData -Parameters $Parameters -JobResourceLocationIdName 'PrepareResourceLocationId' -Verbose $Verbose $ProvisioningType = Get-ProvisioningType -Platform $Platform -ConfigData $ConfigData -Parameters $Parameters -Verbose $Verbose $prepareData['provisioningType'] = $ProvisioningType $prepareData['overwriteTargetFile'] = $Parameters.Contains('Force') -And $Parameters.Force Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "XdReconfigure" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "DomainUnjoin" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "UpdateLayerRepo" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "InstallUpl" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "RunCitrixOptimizer" -JobData $PrepareData -Verbose $Verbose if ($ProvisioningType -eq "Pvs") { $prepareData['installMisa'] = $false $prepareData['forceMisa'] = $false $prepareData['installMcsio'] = $false $prepareData['forceMcsio'] = $false } elseif ($ProvisioningType -eq "Mcs") { $ForceMisa = Get-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "ForceMisa" -Verbose $Verbose if ($ForceMisa) { $prepareData['forceMisa'] = $True } else { $prepareData['installMisa'] = Get-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "InstallMisa" -Verbose $Verbose } $ForceMcsio = Get-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "ForceMcsio" if ($ForceMcsio) { $prepareData['forceMcsio'] = $True } else { $prepareData['installMcsio'] = Get-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "InstallMcsio" -Verbose $Verbose } } # InstallPvs is a valid option for both Pvs and Mcs when PVS AND VDA versions are >= 2311 Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "InstallPvs" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "Chkdsk" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "Defrag" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "EnableRdp" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "OutputDiskName" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "OutputImageName" -JobData $PrepareData -Verbose $Verbose Set-JobParameter -ConfigData $ConfigData -Parameters $Parameters -ParameterName "Md5Hash" -JobData $PrepareData -Verbose $Verbose return $prepareData } function Format-PreparePublishData([string]$Platform, [psobject]$ConfigData, [hashtable]$Parameters, [bool]$Verbose) { $preparePublishData = Format-PrepareData -Platform $Platform -ConfigData $ConfigData -Parameters $Parameters -Verbose $Verbose $preparePublishData['outputStorageLocation'] = @{ Location = Get-SmbLocation -ConfigData $ConfigData -Parameters $Parameters -SmbConfigNode "PublishSmb" -Verbose $Verbose credentialId = Get-SmbParameter -ConfigData $ConfigData -Parameters $Parameters -SmbConfigNode "PublishSmb" -ParameterName 'SmbCwId' -ConfigParameterName 'CwId' -Verbose $Verbose } $preparePublishData['outputImageFilename'] = Get-SmbParameter -ConfigData $ConfigData -Parameters $Parameters -SmbConfigNode "PublishSmb" -ParameterName 'SmbDiskName' -ConfigParameterName 'DiskName' -Verbose $Verbose $preparePublishData['outputImageFormat'] = Get-SmbParameter -ConfigData $ConfigData -Parameters $Parameters -SmbConfigNode "PublishSmb" -ParameterName 'SmbDiskFormat' -ConfigParameterName 'DiskFormat' -Verbose $Verbose $preparePublishData['provisionType'] = "Thin" return $preparePublishData } |