Wilco van Bragt - LinkeIn Wilco van Bragt - Twitter rssa 

Unattended Installation scripts XenDesktop 7.x Part 2 (including RES One Automation Building Blocks)

In part 1 I shared my unattended script for installing the Citrix XenDesktop Delivery Controller component including a small script to join an existing XenDesktop site. In this article I will share my scripts for the Virtual Desktop Agent (VDA) including the PVS Target Device software, VDA Optimization and Default User Profile Optimization. Those scripts are also available as a RES One Automation Building Block.

 Virtual Desktop Agent

Also for the Virtual Desktop Agent installation the unattended parameters are nicely documented on the same page as the Delivery Controller parameters (http://docs.citrix.com/en-us/xenapp-and-xendesktop/7-6/xad-build-new-enviroment/xad-install-command.html), again the added value of my script is the check of the installation has succeeded. In the below shown script the uninstall key is representing the VDA 7.6 FP3 installation {432B6E43-AAE2-4597-BBB5-C6042D5D0EA9}, for the 7.7 VDA the GUID {75541E1E-F48B-4F13-BF74-C9A66CAEDCD1} and for VDA 7.8 the GUID {{F8E7B35D-6B85-45DA-8CA6-2225637F35D9} must be filled in at the $VDAUninstall variable. Also don’t forget to change the $exe variable representing the correct vdaserversetup executable.

I also included a small script to install the Windows roles/features requirements. As the VDA installer automatically adds all other prerequisites I don’t added those manually (the VDA installation is taking good care of that part).

Let’s start sharing the Windows roles and feature script.

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

# Script: AddWindowsFeatures.ps1

# Unattended Installation VDA Windows Features

# Creator: Wilco van Bragt

# Creation Date: 24-11-2015

# Windows-Feature Windows Search Service

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

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

       Install-WindowsFeature Search-Service}

 

# Windows-Feature Desktop-Experience

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

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

       Install-WindowsFeature Desktop-Experience}

       

# Windows-Feature Remote Assistance

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

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

       Install-WindowsFeature Remote-Assistance}

 

# Windows-Feature Remote Desktop Services Host

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

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

       Install-WindowsFeature RDS-RD-Server -IncludeManagementTools}

 

Don’t forget to reboot the machine after this script has run, before you start the unattended VDA installation.

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

# Script: InstallVDA76FP3.ps1

# Unattended Installation VDA 7.6 FP3

# Creator: Wilco van Bragt

# Creation Date: 23-12-2015

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

# Version: 0.1

# By: Wilco van Bragt

# Date: 23-12-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:\Temp"

$VDAUninstall="HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{432B6E43-AAE2-4597-BBB5-C6042D5D0EA9}

$exe="$SourceDir\VDAServerSetup_7.6.300.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

                    }

 

 

#Pre-Checking VDA is already installed

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

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

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

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

                    else

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

   Exit

}

 

 

#Install VDA

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

Write-Host "Start installing VDA"

 

& $exe /quiet /noreboot /enable_remote_assistance /enable_hdx_ports /enable_real_time_transport /masterimage /logpath C:\TEMP\XD76FP3VDA.log | Out-Null

 

Write-Host "Checking installation"

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

                    { Write-Host "The checked uninstall key $VDAUninstall does not exist. VDA installation failed, check the logfile for details." -ForegroundColor Red

                    Exit

                    }

                    else

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

 

#Finalize Script Logging

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

$DateFinish=Get-Date

write-host "Script finished at $DateFinish"

When RES One Automation is available, you only need to set-up het unattended parameters line as an unattended installation and add the Windows Feature scripts (unfortunate RES One Automation has no embedded Windows Feature installation options). Checking if the installation is successful can be done (and pre-check if the software is already installed) via the Query Installed Programs option. My VDA installation Building Block can be downloaded in the Building Block collection at the end of the article, which includes both the 7.6 FP3, 7.7 as the 7.8 installation.

VDA Optimization

Besides the installation I also include some optimizations. There are several article available about optimization the operating system. I’m only adding optimizations if they apply to the OS (many apply only to Desktop Operating Systems) and it does not hurt. The optimizations can be divided in two parts: machine based and user based. For the user based part I’m using the technique in the article of Aaron Parker (http://stealthpuppy.com/customize-the-windows-default-profile/) to make adjustment to the Default Profile.

::@ECHO OFF

REM Load the default profile hive

SET HKEY=HKU\Default

REG LOAD %HKEY% %SystemDrive%\Users\Default\NTUSER.DAT

 

REG ADD "%HKEY%\Control Panel\Sound" /v Beep /t REG_SZ /d NO /f

REG ADD "%HKEY%\Control Panel\Sound" /v ExtendedSounds /t REG_SZ /d NO /f

 

REG ADD "%HKEY%\Control Panel\Desktop" /v HungAppTimeout /t REG_SZ /d 5000 /f

REG ADD "%HKEY%\Control Panel\Desktop" /v AutoEndTasks /t REG_SZ /d 1 /f

REG ADD "%HKEY%\Control Panel\Desktop" /v WaitToKillAppTimeout /t REG_SZ /d 4000 /f

 

REG ADD "%HKEY%\Control Panel\Desktop" /v MenuShowDelay /t REG_SZ /d 150 /f

REG ADD "%HKEY%\Control Panel\Desktop" /v CursorBlinkRate /t REG_SZ /d 795 /f

 

REG ADD "%HKEY%\Control Panel\Desktop" /v CursorBlinkRate /t REG_SZ /d 795 /f

 

REG ADD "%HKEY%\Software\Microsoft\CTF" /v "Disable Thread Input Manager" /t REG_DWORD /d 1 /f

 

REG ADD "%HKEY%\Software\Microsoft\Internet Explorer\Main" /v "Force Offscreen Composition" /t REG_DWORD /d 1 /f

 

REM REG ADD "%HKEY%\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects /v VisualFXSetting /t REG_DWORD /d 2 /f

 

REG ADD "%HKEY%\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\gemeentenet.local" /v file /t REG_DWORD /d 1 /f

 

REG ADD "%HKEY%\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDesktopCleanupWizard /t REG_DWORD /d 1 /f

 

REG ADD "%HKEY%\Software\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 0 /f

 

REG ADD "%HKEY%\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v SeparateProcess /t REG_DWORD /d 1 /f

 

REM Windows 8 navigation settings

REG ADD "%HKEY%\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage" /v OpenAtLogon /t REG_DWORD /d 0 /f

REG ADD "%HKEY%\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage" /v DesktopFirst /t REG_DWORD /d 0 /f

REG ADD "%HKEY%\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage" /v MakeAllAppsDefault /t REG_DWORD /d 0 /f

REG ADD "%HKEY%\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage" /v MonitorOverride /t REG_DWORD /d 0 /f

 

REM Unload the default profile hive




For Windows Server 2012 R2 it’s probably also a good think to limit the right-mouse menu of the Start button a bit. This can be done by deleting the shortcuts in the default profile. I only have those in RES One Automation currently, but it’s easy to script this part in PowerShell as well. More information about this customization can be found in this article http://www.askvg.com/exclusive-customize-new-quick-access-menu-win-x-menu-in-windows-8-add-remove-rename-or-move-shortcuts-and-much-more/.

The RES One Automation Building Block for all user optimization components can be downloaded is available for download in the Building Block collection at the end of the article.

Secondly the machine part is mainly based on a set of registry and disabling schedules tasks and some commands. Again I don’t have those in a complete script, but with the print screen you can create your own script easily. The registry settings can be downloaded as registry file in the Building Block collection at the end of the article.

PVS Target Device

In some way all my project since 2013 are with Citrix Provisioning Services. I already wrote an article series about unattended installation of Citrix Provisioning Services <<LINK>> a while ago. Basically not much has changed for the unattended part since that time. The script includes the check for PVS 7.6 CU1. Installing the PVS Target Device 7.7 software the GUID need to be changed to {3676AF4D-C2A9-4C32-AC56-9BBC4BDA4566} at $PVSTDUninstall variable. The GUID for the PVS Target Device 7.8 software is {C5805949-4079-468D-996D-87185EEED151}.

A RES One Automation Building Block for 7.6, 7.7 as 7.8 is included in the download building block below.

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

# Script: InstallPVSTD76.ps1

# Unattended Installation PVS 7.6 CU1

# Creator: Wilco van Bragt

# Creation Date: 23-12-2015

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

# Version: 0.1

# By: Wilco van Bragt

# Date: 23-12-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:\Temp"

$PVSTDUninstall="HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EF2FD00E-6DE4-4CA3-843B-6F2B7C7CFA39}

$exe="$SourceDir\PVS_Device_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

                    }

 

 

#Pre-Checking PVS TD is already installed

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

Write-Host "Pre-Checking PVS TD software is already installed"

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

                    { Write-Host "The checked uninstall key $PVSTDUninstall does not exit. PVS TD software is not installed, software will be installed."}

                    else

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

   Exit

}

 

 

#Install PVS TD

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

Write-Host "Start installing PVS TD"

 

& $exe /S /v/qb" ALLUSERS=TRUE REBOOT=SUPPRESS /l* C:\Temp\CitrixPVSDeviceTarget.log" | Out-Null

 

Write-Host "Checking installation"

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

                    { Write-Host "The checked uninstall key $PVSTDUninstall does not exist. PVS TD installation failed, check the logfile for details." -ForegroundColor Red

                    Exit

                    }

                    else

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

 

#Finalize Script Logging

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

$DateFinish=Get-Date

write-host "Script finished at $DateFinish"

Summarization

In this 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 an upcoming part three the scripts for StoreFront, Director and the PVS server will be described.

RES One Automation Building Block Collection XenDesktop 7.x - VanBragt.Net