XenApp & XenDesktop 7.x / StoreFront 3.x Silent Setup
Im folgenden Artikel installieren wir einen XenApp & XenDesktop 7.x Server auf einem Windows Server 2016. Der Einfachheit halber werden alle Komponenten auf einem Server installiert.
Die einzelnen Komponenten können natürlich auch zu einem Script zusammengesetzt werden.
Installation
Zum Beginn des Setups deaktivieren wir den Check for Publisher’s Certificate Revocation, um den Aufruf der Konsolen zu beschleunigen.
Set-ItemProperty -path "REGISTRY::\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing\" -name State -value 146944
Zur Installation von XenApp & XenDesktop verbinden wir uns das entpackte ISO als Netzlaufwerk und installierten mit lokaler SQL Datenbank. Neben den Core-Komponenten installieren wir auch den Lizenzserver und Storefront lokal auf der Maschine. Die Pre-Requirements werden bei der Installation automatisch mit installiert.
net use I: \\<Servername>\<Share-Name> cd 'I:\SQL' write-host "Installing SQL Server ..." .\SETUP.EXE /QS /ACTION=install /FEATURES=SQL,Tools /INSTANCENAME=MSSQLSERVER /IAcceptSQLServerLicenseTerms=true cd 'I:\x64\XenDesktop Setup' write-host "Installing XenApp & XenDesktop ..." .\XenDesktopServerSetup.exe /components CONTROLLER,DESKTOPSTUDIO,STOREFRONT,LICENSESERVER /NOSQL /configure_firewall /quiet /logpath C:\Logs shutdown -f -r -t 5
Während der Installation der Requirements und von XenDesktop selbst benötigt der Server einen Reboot (zu erkennen daran, dass in der CLI wieder eingaben gemacht werden können) und auch wenn nach der erneuten Anmeldung das CLI Fenster des Installers nur kurz aufgeht und sich wieder schließt, läuft im Hintergrund die Installation weiter. Den aktuellen Status der Installation kann man sich fortlaufend anzeigen lassen über die PowerShell (in diesem Beispiel lasse ich mir immer die letzten 10 Zeilen des Logs ausgeben):
Get-Content 'C:\Logs\Citrix\XenDesktop Installer\XenDesktop Installation.log' -Tail 10 -Wait
Mit dem Eintrag <Datum/Uhrzeit> : XenDesktopSetup:The process is complete.
ist die Installation abgeschlossen.
Lizenzierung
Da es XenApp & XenDesktop nicht kostenlos gibt, müssen wir das Ganze noch lizenzieren. Hierzu spielen wir manuell die passenden Lizenzen ein und konfigurieren unseren Lizenzserver für XenApp & XenDesktop. Auch diesen haben wir lokal installiert.
Der Produkt-Code und die Produkt-Edition kann per PowerShell mit Get-ConfigProduct
und Get-ConfigProductEdition -ProductCode <Product-Code>
abgefragt werden.
$PC = "<Product-Code>" #z.B. XDT für XenDesktop $PE = "<Product-Edition>" # z.B. ENT für Enterprise Edition Add-PSSnapin Citrix* write-host "Configuring Citrix Licensing ..." Set-XDLicensing -LicenseServerAddress $env:COMPUTERNAME -LicenseServerPort 27000 Set-ConfigSite -LicensingModel Concurrent -ProductCode $PC -ProductEdition $PE
Konfiguration
Nach dem Reboot des Servers konfigurieren wird unsere Datenbankverbindung und die Site.
$SN = "<Site-Name>" $LDB = "<LogDB-Name>" $MDB = "<MonitorDB-Name>" $SDB = "<SiteDB-Name>" Add-PSSnapin Citrix* write-host "Creating Citrix XenApp & XenDesktop Databases ..." New-XDDatabase -AllDefaultDatabases -DatabaseServer $env:COMPUTERNAME -SiteName $SN write-host "Setting up Site ..." New-XDSite -DatabaseServer $env:COMPUTERNAME -LoggingDatabaseName $LDB -MonitorDatabaseName $MDB -SiteDatabaseName $SDB -SiteName $SN
Nachdem Datenbank und Site angelegt sind, benötigen wir einen Machine Catalog (in unserem Fall mit einer physikalischen Maschine), sowie eine Desktop Group mit der Maschine. Im Anschluss fügen wir eine AD-Gruppe für den Zugriff hinzu und konfigurieren den Zugriff über ein Access Gateway.
$XDController = $env:COMPUTERNAME $CatalogName = "<Catalog-Name>" $CatalogDesc = "<Catalog-Description>" $MachineName = "<Machine-Hostname>" $UserGroup = "<Domain-Name>\<AD-UserGroup>" $DeskGroupName = "<DesktopGroup-Name>" $DeskGroupPubName = "<DesktopGroup-Published-Name>" $DeskGroupDesc = "<DesktopGroup-Description>" $DesktopKind = 'Shared' $DeskGroupSessionSupport = 'MultiSession' $DeskGroupFunctionalLev = '<Functional-Level>' # z.B.: L7_15 für XenApp & XenDesktop 7.15 $DeskGroupDeliveryType = 'DesktopandApps' $TimeZone = '<Time-Zone>' # z.B.: CET Central European Time für Mitteleuropa-Zeit $ColorDepth = 'TwentyFourBit' $OffPeakBuffer = 10 $PeakBuffer = 10 Add-PSSnapin Citrix* write-host "Creating Machine Catalog ..." New-BrokerCatalog -SessionSupport MultiSession -ProvisioningType Manual -AllocationType Random -Name $CatalogName -Description $CatalogDesc -PersistUserChanges OnLocal -MachinesArePhysical $true New-BrokerMachine - MachineName $MachineName -CatalogUid 1 write-host "Creating Desktop Group ..." New-BrokerDesktopGroup -ErrorAction SilentlyContinue -AdminAddress $XDController -Name $DeskGroupName -DesktopKind $DesktopKind -DeliveryType $DeskGroupDeliveryType -Description $DeskGroupDesc -PublishedName $ DeskGroupPubName -MinimumFuctionalLevel $DeskGroupFunctionalLev -ColorDepth $ColorDepth -SessionSupport $DeskGroupSessionSupport -InMaintenanceMode $false -IsRemotePC $false -SecureIcaRequired $false -Scope @() $Catalog = Get-BrokerCatalog -AdminAddress $XDController -Name $CatalogName Add-BrokerMachinesToDesktopGroup -AdminAddress $XDController -Catalog $Catalog -Count $Catalog.UnassignedCount -DesktopGroup $DeskGroupName write-host "Configuring Users ..." $Users = New-BrokerUser -AdminAddress $XDController -Name $UserGroup New-BrokerEntitlementPolicyRule -AdminAddress $XDController -Name ($DeskGroupName + "_" +$NumToString ()) -IncludedUsers $Users -DesktopGroupUid $DeskGroupName.Uid -Enabled $true -IncludedUserFilterEnabled $false write-host "Configuring Access Gateway Access ..." New-BrokerAccessPolicyRule -AdminAddress $XDController -Name '<Rule-Name>' -IncludedUsers @($Users.Name) -AllowedConnections 'ViaAG' -AllowedProtocols @ ('HDX','RDP') -AllowRestart $true -DesktopGroupUid $DeskGroupName.Uid -Enabled $true -IncludedSmartAccessFilterEnabled $true -IncludedSmartAccessTags @() -IncludedUserFilterEnabled $true
Möchte man im späteren Schritt SSO und Pass-Through Anmeldung mit Storefront nutzen, muss ggf. noch eine Trust-Einstellung für den XML Service Port auf True gesetzt werden.
Add-PSSnapin Citrix* Set-BrokerSite -TrustRequestsSentToTheXmlServicePort $True
StoreFront Konfiguration
Da wir StoreFront über eine verschlüsselte HTTPS Verbindung nutzen wollen, benötigen wir im ersten Schritt ein SSL-Zertifikat. Dieses haben wir uns von einer öffentlichen oder privaten CA im Vorfeld ausstellen lassen. Wir benötigen das Zertifikat im PFX-Format, als inkl. Private Key. Wir importieren das Zertifikat in den Windows Zertifikatsspeicher und erstellen ein HTTPS Binding im IIS.
$PwdPrompt = read-host -Prompt "Certificate Password:" $CertPwd = ConvertTo-SecureString -String $PwdPrompt -Force -AsPlainText write-host "Importing Certificate ..." Import-PfxCertificate -filepath "<Pfad-zur-Zertifikatsdatei>\<Zertifikatsdatei>.pfx" Cert:\LocalMachine\My -Password $CertPwd write-host "Creating IIS HTTPS Binding ..." New-WebBinding -Name "Default Web Site" -IPAddress "*" -Port 443 -Protocol https cd IIS: cd .\SSLBindings Get-Item Cert:\LocalMachine\My\<Zertifikat-Friendly-Name> | New-Item 0.0.0.0!443 C:
Im Anschluss konfigurieren wir unseren Storefront Store. Hierzu importieren wir als erstes die StoreFront Powershell Module, definieren unsere Variablen und setzen daraus unseren Store zusammen. Danach konfigurieren wir 2 Beacons und die Netscaler Gateway Anbindung.
"%ProgramFiles%\Citrix\Receiver StoreFront\Scripts\ImportModules.ps1" $Domain = $env:USERDOMAIN $NSGWAddress = "https://<Your>.<External>.<NetScaler-URL>" $Port = "80" $TransportType = "HTTP" $SSLRelayPort = "443" $LoadBalance = $false $StoreFriendlyName = "<Store-Name>" $FarmName = "<XenDesktop-Farm-Name>" $FarmType =""XenDesktop" $FQDN = "$env:COMPUTERNAME.$env:USERDNSDOMAIN" $BaseURL = "https://" + $FQDN $SFPath = "/Citrix/" + $Domain.toLower() $SFPathWeb = "$SFPath'Web" $SFPathDesktopAppliance = "$SFPath'DesktopAppliance" $NSGWName = "<NetScaler-Hostname>" $STA = "http://" + $FQDN + "/scripts/ctxsta.dll" $NSGWSnIP = "<NetScaler-Subnet-IP>" write-host "Configuring Storefront Initial Settings ..." Set-DSInitialConfiguration -hostBaseUrl $BaseURL -farmName $FarmName -port $Port -transportType $TransportType -sslRelayPort $SSLRelayPort-servers $FQDN -loadBalance $LoadBalance -farmType $FarmType -StoreFriendlyName $StoreFriendlyName -StoreVirtualPath $SFPath -WebReceiverVirtualPath $SFPathWeb -DesktopApplianceVirtualPath $SFPathDesktopAppliance write-host "Configuring Beacons ..." $BeaconID = ([guid]::NewGuid()).ToString() Add-DSGlobalExternalBeacon -BeaconID $BeaconID -BeaconAddress http://www.google.com $BeaconID = ([guid]::NewGuid()).ToString() Add-DSGlobalExternalBeacon -BeaconID $BeaconID -BeaconAddress http://www.citrix.com write-host "Configuring NetScaler Gateway: Creating Gateway ..." $NSGWId = ([guid]::NewGuid()).ToString() Add-DSGlobalV10Gateway -Id $NSGWId -Name $NSGWName -Address $NSGWAddress -Logon Domain -IPAddress $NSGWSnIP -SessionReliability $false -SecureTicketAuthorityUrls $STA -IsDefault $true write-host "Configuring NetScaler Gateway: Creating Authentication and StoreFront Link ..." $Gateway = Get-DSGlobalGateway -GatewayId $NSGWId Set-DSStoreGateways -SiteId 1 -VirtualPath $SFPath -Gateways $Gateway Set-DSStoreRemoteAccess -SiteId 1 -VirtualPath $SFPath -RemoteAccessType "StoresOnly" Add-DSAuthenticationProtocolsDeployed -SiteId 1 -VirtualPath /Citrix/Authentication -Protocols CitrixAGBasic Set-DSWebReceiverAuthenticationMethods -SiteId 1 -VirtualPath $SFPathWeb -AuthenticationMethods ExplicitForms,CitrixAGBasic
Optional: Da wir $FQDN als $BaseURL verwenden, können wir Loopback OnUsingHTTP aktivieren. Mehr Details siehe hier: http://docs.citrix.com/en-us/storefront/3/sf-plan.html.
write-host "Configuring Loopback ..." Set-DSLoopback -SiteId 1 -VirtualPath $SFPathWeb -Loopback OnUsingHttp
–