In my last blog post Running a Citrix lab in Amazon AWS I showed you how to configure a Citrix XenApp / XenDesktop site and databases unattended with Powershell.
This script is a perfect match for my Automation Framework, but the problem is the Microsoft Deployment Toolkit (MDT). When MDT performs installations, they´re all launched with the local administrator account. So if you just add the script as an application / task sequence the configuration will fail because the logged on administrator account is not a domain account.
The workaround is to use the Run Command Task Sequence and specify the domain account you want it to run as.
Use the following commands:
powershell.exe -ExecutionPolicy Bypass -Command "Copy-Item '%DEPLOYROOT%\Applications\Citrix XenDesktop 7.6\Configure_XA.ps1' -destination C:\Windows\Temp; C:\Windows\Temp\Configure_XA.ps1; Remove-Item C:\Windows\temp\*.ps1 -Force"
Remember that this only applies to your first Delivery Controller, after that you use the following commands to join a new Delivery Controller to an existing site.
$logFile = "C:\Windows\Temp\Join_XA.log"
Write-Output "Logging to $logFile"
Add-XDController -AdminAddress localhost -SiteControllerAddress xadc-01.ctxlab.local