Mit dem folgenden Skript können Sie automatisiert Published Applications / Desktops erstellen. Bitte beachten Sie, dass die Variablen vorher zu definieren sind.
script:
write-host “loading pssnapin for xenapp” -foregroundcolor yellow
add-pssnapin citrix* -erroraction silentlycontinue
$XA_WorkerGroupName = “$env:server_role”
$XA_WorkerGroupName = $XA_WorkerGroupName.Replace(“”, “/”)
$split = $XA_WorkerGroupName.Split(“/”)
$0 = $split[0]
$1 = $split[1]
$farm = get-XAFarm
write-host “loading variables” -foregroundcolor yellow
$XA_Description = “$env:XA_CustomDescription Silo $1 on XenApp Farm $farm”
$XA_FolderPath = “applications$env:s4_role$env:XA_AdvancedFolderPath”
$XA_WorkerGroupName = “$1”
$XA_EncryptionLevel = “Bits128”
$XA_EncryptionRequired = $true
$XA_AudioRequired = $true
$XA_AudioType = “none”
$XA_Random = get-random
$XA_ServersPath = “Servers$env:server_role”
$XA_WaitOnPrinterCreation = $false
$XA_PreLaunch = $false
$XA_EncodedIconData = Get-CtxIcon $env:XA_IconFile -Index 0
$getPA = Get-XAApplication | foreach { “$($_.FolderPath)/$($_.DisplayName)”}
$XA_PAPath = $XA_FolderPath.Replace(“”, “/”)
$PA = “$XA_PAPath/$env:XA_DisplayName”
if ($getPA -contains $PA){
write-host “Published application already exists…”
}
else{
write-host “Published application doesn’t exist. Creating published application…”
$execute = New-XAApplication -ApplicationType $env:XA_ApplicationType -PreLaunch $XA_PreLaunch -FolderPath $XA_FolderPath -DisplayName $env:XA_DisplayName -BrowserName “$env:XA_BrowserName$XA_Random” -Description $XA_Description -CommandLineExecutable $env:XA_CommandLineExecutable -WorkingDirectory $env:XA_WorkingDirectory -WorkerGroupName $XA_WorkerGroupName -accounts $env:XA_accounts -ClientFolder $env:XA_ClientFolder -AddToClientStartMenu $XA_AddToClientStartMenu -StartMenuFolder $env:XA_StartMenuFolder -EncryptionLevel $XA_EncryptionLevel -EncryptionRequired $XA_EncryptionRequired -AudioRequired $XA_AudioRequired -AudioType $XA_AudioType -WaitOnPrinterCreation $XA_WaitOnPrinterCreation -InstanceLimit $env:XA_InstanceLimit -EncodedIconData $XA_EncodedIconData -WindowType $env:XA_WindowType -force -erroraction silentlycontinue
if ($execute -ne $NULL){write-host “Application publishing created successfully” -foregroundcolor green}else{write-host “application publishing failed” -foregroundcolor red}
}
write-host “Clearing variables…” -foregroundcolor yellow
$XA_FolderPath = “”
$env:XA_AdvancedFolderPath = “”