Wilco van Bragt - LinkeIn Wilco van Bragt - Twitter rssa 

Unattended Installation scripts XenDesktop 7.x Part 3

In the second part I shared the scripts and RES One Automation Building Blocks to install unattended a PVS based XenDesktop 7.6 Server VDA. In part 1 the scripts for the Delivery Controller were shared. In this part three article I will show/share the unattended scripts for StoreFront and Director.

Citrix StoreFront

The installation of Citrix StoreFront is nowadays really simple, which also makes it easy to install unattended. For installation only one parameter is required, setting-up the Store and Receiver for Web unattended is also possible, but I’m seeing a trend that this one time configuration is done manually. Especially because the Server Group functionality is working fine, so configuration need to be set-up on one StoreFront server only. Again this script also contains a check if the installation successful. The mentioned uninstall key is for Citrix StroreFront 3.0.1.55, which was released as part of XenDesktop 7.6 Feature Pack 3. When using the Citrix StoreFront delivered with the XenDesktop 7.7 download (3.0.1.57), the GUID is {79FFED9F-5F4C-4BEC-B86E-6CD532CEC46D}. Citrix StoreFront 3.5 GUID (delivered within the XenDesktop 7.8 ISO version 3.5.0.23) is {C15660C5-71A2-45F5-9325-993228D730D3}.

#---------------------------------------------------------------------

# Script: InstallStoreFront.ps1

# Unattended Installation Citrix StoreFront

# Creator: Wilco van Bragt

# Creation Date: 20-11-2015

#---------------------------------------------------------------------

# Version: 0.1

# By: Wilco van Bragt

# Date: 20-11-2015

# Changes: First Version

#---------------------------------------------------------------------

#Start Script Logging

#---------------------------------

$DateFinish=Get-Date

write-host "Script started at $DateFinish"

#Define Variables

#---------------------------------

write-host "Define Variables"

$LogDir="C:\Temp"

$SourceDir = "C:\install"

$StoreFrontUninstall="HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{834783CE-B89B-4235-BE19-6D047A735B0B}"

$exe="$SourceDir\CitrixStoreFront-x64.exe"

#Check paths

#---------------------------------

write-host "Checking if paths exists, otherwise those are created"

If ((Test-Path -path $LogDir) -ne $True)

                    { write-host "$LogDir does not exit, directory will be created."

                                       New-Item -Path $LogDir -Type Directory

                    }

#Import other PowerShell Modules and SnapIns

#---------------------------------

write-host "Import required PowerShell Modules and/or SnapIns"

Import-Module ServerManager

#Pre-Checking StoreFront software is already installed

#---------------------------------

Write-Host "Pre-Checking StoreFront software is already installed"

If ((Test-Path -path "$StoreFrontUninstall") -ne $True)

                    { Write-Host "The checked uninstall key $StoreFrontUninstall does not exit. StoreFront is not yet installed, software will be installed."}

                    else

                    {Write-Host "Uninstall StoreFront Key defined as $StoreFrontUninstall found. StoreFront software already installed on this machine. Installation will be cancelled." -ForegroundColor Yellow

   Exit

}

#Install IIS prerequisites

#---------------------------------

Write-Host "Start installing IIS prerequisites"

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Server"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-Server}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Server"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-Server not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }

                                      

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Basic-Auth"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-Basic-Auth}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Basic-Auth"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-Basic-Auth not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }                                     

                                      

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Http-Redirect"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-Http-Redirect}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Http-Redirect"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-Http-Redirect not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }                 

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Windows-Auth"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-Windows-Auth}       

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Windows-Auth"}                      

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-Windows-Auth not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }                                     

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-App-Dev"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-App-Dev}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-App-Dev"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-App-Dev not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Net-Ext45"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-Net-Ext45}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Net-Ext45"}            

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-Net-Ext45 not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }                                     

                                                                              

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-AppInit"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-AppInit} 

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-AppInit"}                                    

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-AppInit not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }

                                      

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Asp-Net45"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-Asp-Net45}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Asp-Net45"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-Asp-Net45 not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }

                                      

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Mgmt-Tools"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-Mgmt-Tools}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Mgmt-Tools"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-Mgmt-Tools not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }

                                      

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Scripting-Tools"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Web-Scripting-Tools}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Web-Scripting-Tools"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Web-Scripting-Tools not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "NET-Framework-45-Features"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature NET-Framework-45-Features}                               

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "NET-Framework-45-Features"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature NET-Framework-45-Features not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }

#Install StoreFront

#---------------------------------

Write-Host "Start installing StoreFront software"

& $exe -silent -logpath "$LogDir\storefrontinstall.log" | Out-Null

Write-Host "Checking installation"

If ((Test-Path -path "$StoreFrontUninstall") -ne $True)

                    { Write-Host "The checked uninstall key $StoreFrontUninstall does not exit. StoreFront installation failed, check the logfile for details." -ForegroundColor Red

                    Exit

                    }

                    else

                    {Write-Host "Uninstall StoreFront Key defined as $StoreFrontUninstall found. StoreFront installation succesfull." -ForegroundColor Green}

#Finalize Script Logging

#---------------------------------

$DateFinish=Get-Date

write-host "Script finished at $DateFinish"

Citrix Director

It is possible to install Director on a Delivery Controller. In the first part unattended parameter line you will need to add the value DESKTOPDIRECTOR at the components parameter. Personally I like to separate the Directory functionality from the Delivery Controller. As it also using IIS I often combine it with the StoreFront functionality. If separating the Delivery Controller and Directory you need to specify the Delivery Controller names, so Director can get the information from the Delivery Controllers. This is done via a command line utility DirectoryConfig.exe. In the script you need to specify the Delivery Controllers name for this utility. Also this script contain a check, the key is based on the Directory delivered within XenDesktop 7.6 FP2 and FP3 (Director 7.6.300). For the Director of XenDesktop 7.7 the GUID is {FFB5AE90-B80D-4698-AD93-BEBB9B149E1D} also located in the Wow6432Node registry location. For Director delivered with the XenDesktop 7.8 ISO the GUID is {E4A44961-B9A1-44A9-B5A3-859DD1183311}, however this one is located at the “normal” uninstall key (HKLM\Sofware\Microsoft\Windows\Current Version\UnInstall).

Please note that there is also a check for the StoreFront installation included, update the GUID according to the StoreFront version you are using (see above paragraph).

#---------------------------------------------------------------------

# Script: InstallDirector.ps1

# Unattended Installation Citrix Director

# Creator: Wilco van Bragt

# Creation Date: 20-11-2015

#---------------------------------------------------------------------

# Version: 0.1

# By: Wilco van Bragt

# Date: 20-11-2015

# Changes: First Version

#---------------------------------------------------------------------

#Start Script Logging

#---------------------------------

$DateFinish=Get-Date

write-host "Script started at $DateFinish"

#Define Variables

#---------------------------------

write-host "Define Variables"

$SourceDir = "C:\Install"

$DirectorUninstall="HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{FE8BA9E8-C837-4562-B7F2-8DEF176DB379}"

$StoreFrontUninstall="HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{834783CE-B89B-4235-BE19-6D047A735B0B}"

$msi="$SourceDir\DesktopDirector.msi"

$installexe="msiexec.exe"

$directorconfig="C:\inetpub\wwwroot\Director\tools\DirectorConfig.exe"

$DeliveryController1="<<CitrixDC1>>"

$DeliveryController2="<<CitrixDC2>>"

$LogDir="C:\TEMP"

$SourceDir = "C:\Install"

#Check paths

#---------------------------------

write-host "Checking if paths exists, otherwise those are created"

If ((Test-Path -path $LogDir) -ne $True)

                    { write-host "$LogDir does not exit, directory will be created."

                                       New-Item -Path $LogDir -Type Directory

                    }

#Import other PowerShell Modules and SnapIns

#---------------------------------

write-host "Import required PowerShell Modules and/or SnapIns"

Import-Module ServerManager

#Pre-Checking Director software is already installed

#---------------------------------

Write-Host "Pre-Checking StoreFront software is already installed"

If ((Test-Path -path "$DirectorUninstall") -ne $True)

                    { Write-Host "The checked uninstall key $DirectorUninstall does not exit. Director software is not yet installed, software will be installed."}

                    else

                    {Write-Host "Uninstall Director Key defined as $DirectorUninstall found. Director software already installed on this machine. Installation will be cancelled." -ForegroundColor Yellow

   Exit

}

#Install prerequisites

#---------------------------------

Write-Host "Start installing prerequisites"

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Remote-Assistance"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature Remote-Assistance}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Remote-Assistance"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature Remote-Assistance not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "NET-WCF-HTTP-Activation45"}

If ($check.Installed -ne "True"){

       Install-WindowsFeature NET-WCF-HTTP-Activation45}

$check = Get-WindowsFeature | Where-Object {$_.Name -eq "NET-WCF-HTTP-Activation45"}

If ($check.Installed -ne "True"){

       Write-Host "WindowsFeature WCF-HTTP-Activation45 not installed. Exiting script" -ForegroundColor Red

                                       Exit

                                       }                                     

                                      

#Pre-Checking StoreFront software is already installed

#---------------------------------

Write-Host "Pre-Checking StoreFront software is already installed"

If ((Test-Path -path "$StoreFrontUninstall") -ne $True)

                    { Write-Host "The checked uninstall key $StoreFrontUninstall does not exit. StoreFront is not yet installed, please install StoreFront in advance before Director." -ForegroundColor Red

                    Exit}

                    else

                    {Write-Host "Uninstall StoreFront Key defined as $StoreFrontUninstall found. StoreFront software already installed on this machine. Direcotr Installation will continue."

   }

#Install Director

#---------------------------------

Write-Host "Start installing Director software"

& $installexe /i $msi /QB-! /liewa "$LogDir\DirectorInstall.log" | Out-Null

Write-Host "Checking installation"

If ((Test-Path -path "$DirectorUninstall") -ne $True)

                    { Write-Host "The checked uninstall key $DirectorUninstall does not exit. Director installation failed, check the logfile for details." -ForegroundColor Red

                    Exit

                    }

                    else

                    {Write-Host "Uninstall PVS Key defined as $DirectorUninstall found. Director installation succesfull." -ForegroundColor Green}

#Director Configuration

#---------------------------------

Write-Host "Director Configuration"             

Copy-Item "$SourceDir\Logon.aspx" "C:\inetpub\wwwroot\Director"

& $directorconfig /enablera /ddc "$DeliveryController1,$DeliveryController2"                 

                   

#Finalize Script Logging

#---------------------------------

$DateFinish=Get-Date

write-host "Script finished at $DateFinish"


Summarization

In this third and last article I shared the unattended scripts including check of the installation of Citrix StoreFront and Citrix Director. In the first article the script of the Delivery Controller is described, while the second part exists of the unattended scripts for installing the VDA, the PVS Target Device software and the optimizations including RES One Automation Building Blocks.