So auto-install and auto join an already XenDesktop 7 Site is cool but what if you need to automate the first DDC installation ? Here is how I did with help of a great blog (Timm Brochhaus) who made a script available for everyone, and I personally used it.

Let’s do it for a full automated installation, I will install all the components from XenDesktop 7.

XenDesktopServerSetup.exe /COMPONENTS CONTROLLER,DESKTOPSTUDIO,DESKTOPDIRECTOR,LICENSESERVER,STOREFRONT /PASSIVE /NOREBOOT /CONFIGURE_FIREWALL /NOSQL
New-XDDatabase -AdminAddress DDC02 -SiteName TEST-archynet_SITE -DataStore Site -DatabaseServer APP01.metal.inc -DatabaseName XD7_archynet_Site -DatabaseCredentials metal.inc_XD 
New-XDDatabase -AdminAddress DDC02 -SiteName TEST-archynet_SITE -DataStore Logging -DatabaseServer APP01.metal.inc -DatabaseName XD7_archynet_Logging -DatabaseCredentials metal.inc_XD 
New-XDDatabase -AdminAddress DDC02 -SiteName TEST-archynet_SITE -DataStore Monitor -DatabaseServer APP01.metal.inc -DatabaseName XD7_archynet_Monitor -DatabaseCredentials Metal.inc_XD

Timm Brochhaus wrote a very cool blog and give you the explanation about a script he wrote to automate this part with a very useful script. Juts don’t forget to run this script in 32bit mode…. [link]

I did use Timm’s script and here is the result I got :

Name                : XD7-DB_Site
DataStore           : Site
ServerAddress       : app01.metal.inc
MirrorServerAddress : 
IntegratedSecurity  : True
 
Name                : XD7-DB_Logging
DataStore           : Logging
ServerAddress       : app01.metal.inc
MirrorServerAddress : 
IntegratedSecurity  : True
 
Name                : XD7-DB_Monitor
DataStore           : Monitor
ServerAddress       : app01.metal.inc
MirrorServerAddress : 
IntegratedSecurity  : True

3 databases were created, one for the Site informations, one for the log informations and a last one for monitoring (edgesight-like)

Now we are ready for the next step which is site creation with the command New-XDSite

New-XDSite -DatabaseServer app01.metal.inc -LoggingDatabaseName XD7-DB_Logging -MonitorDatabaseName XD7-DB_Monitor -SiteDatabaseName XD7-DB_Site -SiteName TEST_SITE2 -AdminAddress DDC02

with the result :

Name               : TEST_SITE2
Controllers        : {METALDDC02}
Databases          : {Site, Logging, Monitor}
DefaultIconUid     : 1
LicenseInformation : PLT
Metadata           : {[Citrix_StoreFront_Cluster_Id, 29eaffbb-0915-47a2-a856-641ec5703ef1], [ConfiguredComponents, Admin Config Log Acct Hyp Prov Broker Lic Monitor Pvs Sf 
                     UpmSdk EnvTest AppV], [Studio_SiteConfigurationComplete, True]}

If I use the script Timm make available and use the same syntax, this is pretty easy to add this line and add what we need to automate DataBase creation + Site creation in one script :

$DatabaseServer = "serverbdd.domain.inc"
$DatabaseName_Site = "XD7-DB_Site"
$DatabaseName_Logging = "XD7-DB_Logging"
$DatabaseName_Monitor = "XD7-DB_Monitor"
 
# Database user must be sysadmin on db server
$DatabaseUser = "DomainUsername"
$DatabasePassword = "********"
 
$XD7Site = "XD7TEST"
 
$DatabasePassword = $DatabasePassword | ConvertTo-SecureString -asPlainText -Force
$Database_CredObject = New-Object System.Management.Automation.PSCredential($DatabaseUser,$DatabasePassword)
 
Add-PSSnapin Citrix.*
New-XDDatabase -AdminAddress $env:COMPUTERNAME -SiteName $XD7Site -DataStore Site -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName_Site -DatabaseCredentials $Database_CredObject 
New-XDDatabase -AdminAddress $env:COMPUTERNAME -SiteName $XD7Site -DataStore Logging -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName_Logging -DatabaseCredentials $Database_CredObject 
New-XDDatabase -AdminAddress $env:COMPUTERNAME -SiteName $XD7Site -DataStore Monitor -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName_Monitor -DatabaseCredentials $Database_CredObject 
 
New-XDSite -DatabaseServer $DatabaseServer -LoggingDatabaseName $DatabaseName_Logging -MonitorDatabaseName $DatabaseName_Monitor -SiteDatabaseName $DatabaseName_Site -SiteName $XD7Site -AdminAddress $env:COMPUTERNAME -DatabaseCredentials $Database_CredObject

So now your XenDesktop 7 DDC is ready to work, you can launch the Desktop Studio console, you just need to create your Machine Catalogs and Delivery Groups etc… This next part of automation is in my next blog about XenDesktop 7

2013-07-05_23-04-23

 

39 255

  • Pingback: Citrix XenDesktop 7 – Create Persistent Hypervisor Connection and Hosting Unit, Unattended | archy.net()

  • Terry highfield

    Hi Stephane,

    Nice article. Don’t forget to also run Set-XDLicensing to connect your Site to a license server. This can also be performed via Studio of course.

    Regards,

    Terry

  • Niels Holm

    Great post
    There is a small typo in the ‘Create_XD7DB_Site.ps1’ script ..
    ‘-SiteName’ should be ‘-SiteName $XD7Site’ instead of ‘-SiteName $DatabaseName_Site’

  • Thanks Niels
    I will correct that 🙂

    Stephane

  • Hi Stefan,

    Great post and very helpful with my automation attempts, however I’m getting issues when I try to create the databases. I’m using SQL Express 2012 on a separate server and the account I’m using is a SysAdmin. I’ve even reinstalled SQL Express with the default instanace of SQLExpress but keep getting the same error:

    PS C:UsersCTXAdminDocuments> New-XDDatabase -AdminAddress 2012R2-XDC -DatabaseServer 2012R2_DCSQLEXPRESS -AllDefaultDatabases -SiteName XD7
    New-XDDatabase : Failed to connect to the database server
    At line:1 char:1
    + New-XDDatabase -AdminAddress 2012R2-XDC -DatabaseServer 2012R2_DCSQLEXPRESS -Al …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ResourceUnavailable: (:) [New-XDDatabase], DatabaseConnectionException
    + FullyQualifiedErrorId : Citrix.XDPowerShell.DatabaseConnection,Citrix.XenDesktopPowerShellSdk.Sdk.Configuration.
    NewXDDatabaseCommand

    Any ideas?

    Thanks,

    Stephen

    • Hi Stephen
      Are you using powershell 32 bit or 64 bit to run your script ?

      Stephane

    • Hi Stephane,

      Don’t worry – fixed it. RTFM! I was using SQL 2012 and it needed SQL 2012 SP1. After I upgraded… boom! All good.

      Cheers,

      Stephen

  • Hi Stephane,

    I’ve tried both. Same error on 32-bit. Not sure where the issue is… Any good way to troubleshoot? I can create an ODBC connection to the SQL server with the credentials.

    Thanks,

    Stephen

  • Cool ! Good to know 🙂

    Stephane