In today´s blog post I´m going to show you how to install, configure and customize a Citrix StoreFront Deployment completely unattended in 5 minutes.
This post is based upon Securing Citrix X1 StoreFront with Powershell and Citrix Netscaler Gateway and X1 StoreFront Customization.
The final step to complete automation is to configure StoreFront, so I asked around on Twitter and Ufuk Kocak happily shared his script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# Add required Windows Features #============================== Import-Module ServerManager Add-WindowsFeature AS-Net-Framework,Web-Net-Ext45,Web-AppInit,Web-ASP-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Default-Doc,Web-HTTP-Errors,Web-Static-Content,Web-HTTP-Redirect,Web-HTTP-Logging,Web-Filtering,Web-Windows-Auth # Citrix Parameters #================== $HostBaseURL = "https://storefront.ctxlab.com" # FQDN of the required Storefront URL. In case of cluster, use cluster URL $Farmname = "Site_CTXLAB" $Port = "80" # XML port $TransportType = "HTTP" # XML transport type $sslRelayPort = "443" $Servers = "dc01.ctxlab.com","dc02.ctxlab.com" # List of XML servers (FQDN) $LoadBalance = $true $FarmType = "XenApp" # XenDesktop or XenApp #$InternalBeacon = "https://storefront.ctxlab.com" #[Array]$ExternalBeacons = @("http://www.citrix.com","http://www.google.com") # Install Citrix StoreFront #========================== $Process="E:\x64\StoreFront\CitrixStoreFront-x64.exe" $Arguments='-silent' Start-Process $Process -ArgumentList $arguments -wait # Import Storefront modules #========================== . "C:\Program Files\Citrix\Receiver StoreFront\Scripts\ImportModules.ps1" # Setup Initial Configuration #============================ Set-DSInitialConfiguration -hostBaseUrl $HostBaseURL -farmName $Farmname -port $Port -transportType $TransportType -sslRelayPort $sslRelayPort -servers $Servers -loadBalance $LoadBalance -farmType $FarmType # Config Internal Beacon #======================== #Set-DSGlobalInternalBeacon -BeaconAddress $InternalBeacon # Config External Beacon #======================= #Set-DSGlobalExternalBeacons -Beacons $ExternalBeacons[0],$ExternalBeacons[1] # Disable check publisher's certificate revocation (to speed up console start-up) #================================================================================ set-ItemProperty -path "REGISTRY::\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing\" -name State -value 146944 |
I wanted to automate all this with Chocolatey and Boxstarter, so here´s the final result. Let´s jump into it.
First we need to create the script that will bind all the bits together, I´ve called it SFDemo.nupkg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# Disable Zone Checking CINST Disable_Zone_Checking # Install Core Applications CINST StoreFront CINST Import_Bind_Domain_SSL CINST StoreFront_Config CINST StoreFront_Custom # Enable Zone Checking CINST Enable_Zone_Checking |
Instead of installing all the Roles and Feature with choco windowsfeatures I´m letting the Citrix setup take care of this automatically. Simply rename the old CitrixStoreFront-x64.exe and copy in the new Citrix X1 StoreFront file.
StoreFront.nupkg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# Declaring Variables $Vendor ='Citrix' $Product ='XenApp' $Version ='7.6' $packageName = 'StoreFront' $installerType = 'exe' $destination="${env:ChocoRepository}" + "\$Vendor\$Product\$Version\x64\XenDesktop Setup\" $unattendedArgs = '/quiet /components StoreFront /Configure_Firewall /logpath $Log /noreboot' $log = 'C:\Temp' # Running Install cd $destination Try { (Start-Process -FilePath "XenDesktopServerSetup.exe" -ArgumentList $unattendedArgs -Wait -Passthru).ExitCode Write-ChocolateySuccess $packageName } catch { Write-ChocolateyFailure $packageName $($_.Exception.Message) throw } |
You should always use HTTPS to secure your Citrix environment so we´re going to import and bind the domain wildcard SSL Certificate. More info in the post Securing Citrix X1 StoreFront with Powershell.
Import_Bind_Domain_SSL.nupkg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Declaring Variables $Vendor ='' $Product ='Scripts' $Version ='' $packageName = 'Import and Bind Domain SSL' $installerType = 'ps1' $destination="${env:ChocoRepository}" + "\$Vendor\$Product\$Version\$packageName.$installerType" # Running Install try { powershell.exe -ExecutionPolicy bypass -file $destination Write-ChocolateySuccess "$packageName" } catch { Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" throw } |
Import and Bind Domain SSL.ps1:
1 2 3 4 5 6 7 8 9 10 11 12 |
import-module webadministration $PFXPath="${env:XA}" + "\Certificates\wildcard-ctxlab-aws.pfx" $PFXPassword="Password" $strThumb="3b239166a8d1a7e9c3810fdfa4273fdd35f4514f" certutil -f -importpfx -p $PFXPassword $PFXPath Push-Location IIS: cd SslBindings New-webBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https get-item cert:\LocalMachine\MY\$strThumb | new-item 0.0.0.0!443 Pop-Location |
StoreFront_Config.nupkg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Declaring Variables $Vendor ='' $Product ='Scripts' $Version ='' $packageName = 'StoreFront Configuration' $installerType = 'ps1' $destination="${env:ChocoRepository}" + "\$Vendor\$Product\$Version\$packageName.$installerType" # Running Install try { powershell.exe -ExecutionPolicy bypass -file $destination Write-ChocolateySuccess "$packageName" } catch { Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" throw } |
StoreFront Configuration.ps1:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# Citrix Parameters #================== $HostBaseURL = "https://sf-01.ctxlab.aws" # FQDN of the required Storefront URL. In case of cluster, use cluster URL $Farmname = "CTXLAB" $Port = "443" # XML port $TransportType = "HTTPS" # XML transport type $sslRelayPort = "443" $Servers = "dc-01.ctxlab.aws","dc-02.ctxlab.aws" # List of XML servers (FQDN) $LoadBalance = $true $FarmType = "XenDesktop" # XenDesktop or XenApp #$InternalBeacon = "https://sf-01.ctxlab.aws" #[Array]$ExternalBeacons = @("http://www.citrix.com","http://www.google.com") # Import Storefront modules #========================== . "C:\Program Files\Citrix\Receiver StoreFront\Scripts\ImportModules.ps1" # Setup Initial Configuration #============================ Set-DSInitialConfiguration -hostBaseUrl $HostBaseURL -farmName $Farmname -port $Port -transportType $TransportType -sslRelayPort $sslRelayPort -servers $Servers -loadBalance $LoadBalance -farmType $FarmType # Config Internal Beacon #======================== #Set-DSGlobalInternalBeacon -BeaconAddress $InternalBeacon # Config External Beacon #======================= #Set-DSGlobalExternalBeacons -Beacons $ExternalBeacons[0],$ExternalBeacons[1] # Disable check publisher's certificate revocation (to speed up console start-up) #================================================================================ set-ItemProperty -path "REGISTRY::\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing\" -name State -value 146944 |
StoreFront_Custom.nupkg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Declaring Variables $Vendor ='' $Product ='Scripts' $Version ='' $packageName = 'StoreFront Custom' $installerType = 'ps1' $destination="${env:ChocoRepository}" + "\$Vendor\$Product\$Version\$packageName.$installerType" # Running Install try { powershell.exe -ExecutionPolicy bypass -file $destination Write-ChocolateySuccess "$packageName" } catch { Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" throw } |
StoreFront Custom.ps1:
1 2 3 4 5 |
Rename-item C:\inetpub\wwwroot\Citrix\StoreWeb\receiver\images\2x\ReceiverFullScreenBackground_46E559C0E6B5A27B.jpg ReceiverFullScreenBackground_46E559C0E6B5A27B.old Rename-item C:\inetpub\wwwroot\Citrix\StoreWeb\receiver\images\1x\CitrixReceiver_WebScreen_CBE548FB8FEE049E.png CitrixReceiver_WebScreen_CBE548FB8FEE049E.old Copy-item "\\dc-01.ctxlab.aws\ChocoRepository\Citrix\StoreFront\Custom X1\X1 StoreFront Background.jpg" -Destination "C:\inetpub\wwwroot\Citrix\StoreWeb\receiver\images\2x\ReceiverFullScreenBackground_46E559C0E6B5A27B.jpg" -Recurse Copy-item "\\dc-01.ctxlab.aws\ChocoRepository\Citrix\StoreFront\Custom X1\Login Page Logo.png" -Destination "C:\inetpub\wwwroot\Citrix\StoreWeb\receiver\images\1x\CitrixReceiver_WebScreen_CBE548FB8FEE049E.png" -Recurse |
Let´s run it.
1 2 |
$cred = get-credential ctxlab\administrator Install-BoxstarterPackage -PackageName SFDemo -ComputerName sf-01.ctxlab.local -Credential $cred |
Just around 5 minutes, sweet!
When I was doing research for this article I found an awesome blog post showing you how to automatically get all your installed Windows Roles and Features. You now, finding all the prerequisites and creating Choco instructions can takes some time. Read more about it here Automatically Generating a Chocolatey Install Script.
Automation is King, but when it fails it´s a pain in the ass. But don´t worry, download my NUPKG Starter Pack which are packed with these and more examples & binaries to get you a flying start and save 40 hours of work that I´ve spent to make it easier for you!
New to Chocolatey and Boxstarter? Learn more here:
Hi,
Great job here! What is the name of the store in this version (2.6)? Using Set-DSInitialConfiguration creates a “storefront service” store name (or something like this). Space in the name prevent me to load balance it with NetScaler using storefront monitor.
Regards.
Jerome
Thanks, I have not looked at Load Balancing, the version used was 2.7 (X1) and yes I believe the name was StoreFront Service. Could you provide some more details, blog post etc. I can discuss the issue with the StoreFront team at our CTP meeting at Citrix Synergy now in May.
This > http://discussions.citrix.com/topic/338865-load-balanced-vip-storefront-monitor/
Hi Jerome,
Silly question, but did you try the usual fix of entering the space-separated name within quotation marks? Sorry if I am completely off-track here.
Mayunk
@mayunkj
Yes that has been tried as well according to the forums thread. Thanks Mayunk.
there is an update for managing beacons.
the way presented here was updated in the meantime as per this article : https://support.citrix.com/article/CTX206009