Citrix XenDesktop 5 automation

I needed to find a way to deploy XenDesktop 5 Desktop Delivery Controller on demand, and the best way to industrialize the auto insertion in a XenDesktop 5 existing site. Of course, as the environment will be very large, I have access to an automation software like Altiris, SCCM etc… You need to know, adding and removing XenDesktop controller from site require some privilege and rights on the database server. In large environment, this is not so easy to gain access to the database servers but at least you’ll have the information and the script to send to the SQL DBA.

First I install manually the first XenDesktop 5 server to configure database and have everything ready. This is a old XenApp habit and you’ll see with the information bellow, you can even industrialize the installation and the site / database creation pretty easily. To do so, there is an executable XenDesktopServerSetup.exe on the DVD (x:\x64\XenDesktop Setup\XenDesktopServerSetup.exe) and if you type /? the information bellow appears :

Here is the command line I used to deploy the DDC, without the Web Interface, database and license server, I also have disable the firewall with Active Directory GPOs so I don’t use the /configure_firewall option.

XenDesktopServerSetup.Exe /COMPONENTS CONTROLLER,DESKTOPSTUDIO,DESKTOPDIRECTOR /quiet /nosql

Don’t forget the server where you chose to deploy XenDesktop 5 must be in an Active Directory Domain otherwise the installation will be fine but you won’t be able to launch Desktop Studio (many error messages…) Now XenDesktop is installed but not configured. The next steps took me a while because there is no 1,2,3 manual to industrialize the integration of a new XenDesktop 5 server in a site, at least I didn’t find any on the net…

I wanted to download and install Citrix XenDesktop 5 SDK but it’s already install by default with XD5, to check if you can use and access it, launch the PowerShell (Start/All Programs/Accessories/PowerShell) and type Asnp Citrix.* then Get-Command –Module Citrix.* to check if you’re able to list all the command available to use. You should see the same list as bellow :

CommandType     Name                                                Definition
-----------     ----                                                ----------
Cmdlet          Add-AcctADAccount                                   Add-AcctADAccount [-IdentityPoolName] <String> -...
Cmdlet          Add-AcctTaskMetadata                                Add-AcctTaskMetadata [-TaskId] <Guid> [-Property...
Cmdlet          Add-BrokerAdministrator                             Add-BrokerAdministrator [-InputObject] <Administ...
Cmdlet          Add-BrokerApplication                               Add-BrokerApplication [-InputObject] <Applicatio...
Cmdlet          Add-BrokerMachine                                   Add-BrokerMachine [-InputObject] <Machine[]> [-D...
Cmdlet          Add-BrokerMachinesToDesktopGroup                    Add-BrokerMachinesToDesktopGroup [-Catalog] <Cat...
Cmdlet          Add-BrokerTag                                       Add-BrokerTag [-InputObject] <Tag[]> [-DesktopGr...
Cmdlet          Add-BrokerUser                                      Add-BrokerUser [-InputObject] <User[]> [-Machine...
Cmdlet          Add-ConfigGlobalMetadata                            Add-ConfigGlobalMetadata [-Property] <String> -V...
Cmdlet          Add-ConfigRegisteredServiceInstanceMetadata         Add-ConfigRegisteredServiceInstanceMetadata [-Se...
Cmdlet          Add-ConfigServiceGroupMetadata                      Add-ConfigServiceGroupMetadata [-ServiceGroupUid...
Cmdlet          Add-ConfigTaskMetadata                              Add-ConfigTaskMetadata [-TaskId] <Guid> [-Proper...
Cmdlet          Add-HypHostingUnitStorage                           Add-HypHostingUnitStorage [-LiteralPath] <String...
Cmdlet          Add-HypHypervisorConnectionAddress                  Add-HypHypervisorConnectionAddress [-LiteralPath...
Cmdlet          Add-HypMetadata                                     Add-HypMetadata [-LiteralPath] <String> [-Proper...
Cmdlet          Add-HypTaskMetadata                                 Add-HypTaskMetadata [-TaskId] <Guid> [-Property]...
Cmdlet          Add-ProvSchemeControllerAddress                     Add-ProvSchemeControllerAddress [-ProvisioningSc...
Cmdlet          Add-ProvSchemeMetadata                              Add-ProvSchemeMetadata [-ProvisioningSchemeName]...
Cmdlet          Add-ProvTaskMetadata                                Add-ProvTaskMetadata [-TaskId] <Guid> [-Property...
Cmdlet          Add-PvsVmTaskMetadata                               Add-PvsVmTaskMetadata [-TaskId] <Guid> [-Propert...
Cmdlet          Clear-CtxTraceSession                               Clear-CtxTraceSession [[-ServerName] <String[]>]...
Cmdlet          Copy-BrokerApplication                              Copy-BrokerApplication [-Application] <Applicati...
Cmdlet          Copy-CtxSystemInformation                           Copy-CtxSystemInformation [[-ServerName] <String...
Cmdlet          Copy-CtxTraceLog                                    Copy-CtxTraceLog [[-ServerName] <String[]>] [-Lo...
Cmdlet          Disconnect-BrokerSession                            Disconnect-BrokerSession [-InputObject] <Session...
Cmdlet          Export-BrokerDesktopPolicy                          Export-BrokerDesktopPolicy [-AdminAddress <Strin...
Cmdlet          Get-AcctADAccount                                   Get-AcctADAccount [-ADAccountSid <String>] [-Dom...
Cmdlet          Get-AcctAdministrator                               Get-AcctAdministrator [-AccountSid <String>] [-R...
Cmdlet          Get-AcctAdminPermission                             Get-AcctAdminPermission [-AdminAddress <String>]...
Cmdlet          Get-AcctDBConnection                                Get-AcctDBConnection [-AdminAddress <String>] [-...
Cmdlet          Get-AcctDBSchema                                    Get-AcctDBSchema [-DatabaseName <String>] [-Serv...
Cmdlet          Get-AcctDBVersionChangeScript                       Get-AcctDBVersionChangeScript -DatabaseName <Str...
Cmdlet          Get-AcctIdentityPool                                Get-AcctIdentityPool [[-IdentityPoolName] <Strin...
Cmdlet          Get-AcctInstalledDBVersion                          Get-AcctInstalledDBVersion [-Upgrade] [-Downgrad...
Cmdlet          Get-AcctService                                     Get-AcctService [-ReturnTotalRecordCount] [-MaxR...
Cmdlet          Get-AcctServiceInstance                             Get-AcctServiceInstance [-AdminAddress <String>]...
Cmdlet          Get-AcctServiceStatus                               Get-AcctServiceStatus [-AdminAddress <String>] [...
Cmdlet          Get-AcctTask                                        Get-AcctTask [[-TaskId] <Guid>] [-Type <JobType>...
Cmdlet          Get-BrokerAccessPolicyRule                          Get-BrokerAccessPolicyRule [[-Name] <String>] [-...
Cmdlet          Get-BrokerAdministrator                             Get-BrokerAdministrator [[-Name] <String>] [-Bro...
Cmdlet          Get-BrokerAdminPermission                           Get-BrokerAdminPermission -Global [-AdminAddress...
Cmdlet          Get-BrokerApplication                               Get-BrokerApplication [[-BrowserName] <String>] ...
Cmdlet          Get-BrokerApplicationFolder                         Get-BrokerApplicationFolder [[-Name] <String>] [...
Cmdlet          Get-BrokerApplicationInstance                       Get-BrokerApplicationInstance [-ApplicationUid <...
Cmdlet          Get-BrokerAssignmentPolicyRule                      Get-BrokerAssignmentPolicyRule [[-Name] <String>...
Cmdlet          Get-BrokerCatalog                                   Get-BrokerCatalog [[-Name] <String>] [-Administr...
Cmdlet          Get-BrokerConfiguredFTA                             Get-BrokerConfiguredFTA [-ApplicationUid <Int32>...
Cmdlet          Get-BrokerController                                Get-BrokerController [[-MachineName] <String>] [...
Cmdlet          Get-BrokerDBConnection                              Get-BrokerDBConnection [-AdminAddress <String>] ...
Cmdlet          Get-BrokerDBSchema                                  Get-BrokerDBSchema -DatabaseName <String> [-Serv...
Cmdlet          Get-BrokerDBVersionChangeScript                     Get-BrokerDBVersionChangeScript -DatabaseName <S...
Cmdlet          Get-BrokerDelayedHostingPowerAction                 Get-BrokerDelayedHostingPowerAction [[-MachineNa...
Cmdlet          Get-BrokerDesktop                                   Get-BrokerDesktop [[-MachineName] <String>] [-Ag...
Cmdlet          Get-BrokerDesktopGroup                              Get-BrokerDesktopGroup [[-Name] <String>] [-Admi...
Cmdlet          Get-BrokerDesktopUsage                              Get-BrokerDesktopUsage [-DesktopGroupName <Strin...
Cmdlet          Get-BrokerEntitlementPolicyRule                     Get-BrokerEntitlementPolicyRule [[-Name] <String...
Cmdlet          Get-BrokerHostingPowerAction                        Get-BrokerHostingPowerAction [[-MachineName] <St...
Cmdlet          Get-BrokerHypervisorAlert                           Get-BrokerHypervisorAlert [-HostingServerName <S...
Cmdlet          Get-BrokerHypervisorConnection                      Get-BrokerHypervisorConnection [[-Name] <String>...
Cmdlet          Get-BrokerIcon                                      Get-BrokerIcon [-ReturnTotalRecordCount] [-MaxRe...
Cmdlet          Get-BrokerImportedFTA                               Get-BrokerImportedFTA [[-ExtensionName] <String>...
Cmdlet          Get-BrokerInstalledDbVersion                        Get-BrokerInstalledDbVersion [-Upgrade] [-Downgr...
Cmdlet          Get-BrokerMachine                                   Get-BrokerMachine [[-MachineName] <String>] [-As...
Cmdlet          Get-BrokerPowerTimeScheme                           Get-BrokerPowerTimeScheme [[-Name] <String>] [-D...
Cmdlet          Get-BrokerPrivateAppDesktop                         Get-BrokerPrivateAppDesktop [[-MachineName] <Str...
Cmdlet          Get-BrokerPrivateDesktop                            Get-BrokerPrivateDesktop [[-MachineName] <String...
Cmdlet          Get-BrokerResource                                  Get-BrokerResource [-User] <String> [-Groups <St...
Cmdlet          Get-BrokerServiceInstance                           Get-BrokerServiceInstance [-AdminAddress <String...
Cmdlet          Get-BrokerServiceStatus                             Get-BrokerServiceStatus [-AdminAddress <String>]...
Cmdlet          Get-BrokerSession                                   Get-BrokerSession [-AutonomouslyBrokered] [-Brok...
Cmdlet          Get-BrokerSessionSharingIncompatibleApplication     Get-BrokerSessionSharingIncompatibleApplication ...
Cmdlet          Get-BrokerSharedAppDesktop                          Get-BrokerSharedAppDesktop [[-MachineName] <Stri...
Cmdlet          Get-BrokerSharedDesktop                             Get-BrokerSharedDesktop [[-MachineName] <String>...
Cmdlet          Get-BrokerSite                                      Get-BrokerSite [-AdminAddress <String>] [-Verbos...
Cmdlet          Get-BrokerTag                                       Get-BrokerTag [[-Name] <String>] [-UUID <Guid>] ...
Cmdlet          Get-BrokerUnconfiguredMachine                       Get-BrokerUnconfiguredMachine [[-MachineName] <S...
Cmdlet          Get-BrokerUser                                      Get-BrokerUser [[-Name] <String>] [-FullName <St...
Cmdlet          Get-BrokerUserDesktopAppAssignment                  Get-BrokerUserDesktopAppAssignment [-AccountSID ...
Cmdlet          Get-ConfigAdministrator                             Get-ConfigAdministrator [-AccountSid <String>] [...
Cmdlet          Get-ConfigAdminPermission                           Get-ConfigAdminPermission [-AdminAddress <String...
Cmdlet          Get-ConfigDBConnection                              Get-ConfigDBConnection [-AdminAddress <String>] ...
Cmdlet          Get-ConfigDBSchema                                  Get-ConfigDBSchema [-DatabaseName <String>] [-Se...
Cmdlet          Get-ConfigDBVersionChangeScript                     Get-ConfigDBVersionChangeScript -DatabaseName <S...
Cmdlet          Get-ConfigGlobalMetadata                            Get-ConfigGlobalMetadata [-Property <String>] [-...
Cmdlet          Get-ConfigInstalledDBVersion                        Get-ConfigInstalledDBVersion [-Upgrade] [-Downgr...
Cmdlet          Get-ConfigRegisteredServiceInstance                 Get-ConfigRegisteredServiceInstance [-ServiceIns...
Cmdlet          Get-ConfigService                                   Get-ConfigService [-ReturnTotalRecordCount] [-Ma...
Cmdlet          Get-ConfigServiceGroup                              Get-ConfigServiceGroup [-ServiceGroupUid <Guid>]...
Cmdlet          Get-ConfigServiceInstance                           Get-ConfigServiceInstance [-AdminAddress <String...
Cmdlet          Get-ConfigServiceStatus                             Get-ConfigServiceStatus [-AdminAddress <String>]...
Cmdlet          Get-ConfigTask                                      Get-ConfigTask [[-TaskId] <Guid>] [-Type <JobTyp...
Cmdlet          Get-CtxConfigurationLogReport                       Get-CtxConfigurationLogReport [-DataLinkPath] <S...
Cmdlet          Get-CtxIcon                                         Get-CtxIcon [-FileName] <String> [-ServerName <S...
Cmdlet          Get-CtxProfileApplication                           Get-CtxProfileApplication [-ProfileLocation] <St...
Cmdlet          Get-CtxTraceProvider                                Get-CtxTraceProvider [[-ProviderName] <String[]>...
Cmdlet          Get-CtxTraceSession                                 Get-CtxTraceSession [[-ServerName] <String[]>] [...
Cmdlet          Get-HypAdministrator                                Get-HypAdministrator [-AccountSid <String>] [-Re...
Cmdlet          Get-HypAdminPermission                              Get-HypAdminPermission [-AdminAddress <String>] ...
Cmdlet          Get-HypConfigurationDataForItem                     Get-HypConfigurationDataForItem [-LiteralPath] <...
Cmdlet          Get-HypDBConnection                                 Get-HypDBConnection [-AdminAddress <String>] [-V...
Cmdlet          Get-HypDBSchema                                     Get-HypDBSchema [-DatabaseName <String>] [-Servi...
Cmdlet          Get-HypDBVersionChangeScript                        Get-HypDBVersionChangeScript -DatabaseName <Stri...
Cmdlet          Get-HypHypervisorPlugin                             Get-HypHypervisorPlugin [-AdminAddress <String>]...
Cmdlet          Get-HypInstalledDBVersion                           Get-HypInstalledDBVersion [-Upgrade] [-Downgrade...
Cmdlet          Get-HypService                                      Get-HypService [-ReturnTotalRecordCount] [-MaxRe...
Cmdlet          Get-HypServiceInstance                              Get-HypServiceInstance [-AdminAddress <String>] ...
Cmdlet          Get-HypServiceStatus                                Get-HypServiceStatus [-AdminAddress <String>] [-...
Cmdlet          Get-HypTask                                         Get-HypTask [[-TaskId] <Guid>] [-Type <JobType>]...
Cmdlet          Get-HypVMMacAddress                                 Get-HypVMMacAddress [-LiteralPath] <String> [-Ad...
Cmdlet          Get-HypXenServerAddress                             Get-HypXenServerAddress [-LiteralPath] <String> ...
Cmdlet          Get-ProvAdministrator                               Get-ProvAdministrator [-AccountSid <String>] [-R...
Cmdlet          Get-ProvAdminPermission                             Get-ProvAdminPermission [-AdminAddress <String>]...
Cmdlet          Get-ProvDBConnection                                Get-ProvDBConnection [-AdminAddress <String>] [-...
Cmdlet          Get-ProvDBSchema                                    Get-ProvDBSchema [-DatabaseName <String>] [-Serv...
Cmdlet          Get-ProvDBVersionChangeScript                       Get-ProvDBVersionChangeScript -DatabaseName <Str...
Cmdlet          Get-ProvInstalledDBVersion                          Get-ProvInstalledDBVersion [-Upgrade] [-Downgrad...
Cmdlet          Get-ProvScheme                                      Get-ProvScheme [[-ProvisioningSchemeName] <Strin...
Cmdlet          Get-ProvSchemeMasterVMImageHistory                  Get-ProvSchemeMasterVMImageHistory [-Provisionin...
Cmdlet          Get-ProvService                                     Get-ProvService [-ReturnTotalRecordCount] [-MaxR...
Cmdlet          Get-ProvServiceInstance                             Get-ProvServiceInstance [-AdminAddress <String>]...
Cmdlet          Get-ProvServiceStatus                               Get-ProvServiceStatus [-AdminAddress <String>] [...
Cmdlet          Get-ProvTask                                        Get-ProvTask [[-TaskId] <Guid>] [-Type <JobType>...
Cmdlet          Get-ProvVM                                          Get-ProvVM [[-ProvisioningSchemeName] <String>] ...
Cmdlet          Get-PvsVmAdministrator                              Get-PvsVmAdministrator [-AccountSid <String>] [-...
Cmdlet          Get-PvsVmAdminPermission                            Get-PvsVmAdminPermission [-AdminAddress <String>...
Cmdlet          Get-PvsVmDBConnection                               Get-PvsVmDBConnection [-AdminAddress <String>] [...
Cmdlet          Get-PvsVmDBSchema                                   Get-PvsVmDBSchema [-DatabaseName <String>] [-Ser...
Cmdlet          Get-PvsVmDBVersionChangeScript                      Get-PvsVmDBVersionChangeScript -DatabaseName <St...
Cmdlet          Get-PvsVmInstalledDBVersion                         Get-PvsVmInstalledDBVersion [-Upgrade] [-Downgra...
Cmdlet          Get-PvsVmService                                    Get-PvsVmService [-ReturnTotalRecordCount] [-Max...
Cmdlet          Get-PvsVmServiceInstance                            Get-PvsVmServiceInstance [-AdminAddress <String>...
Cmdlet          Get-PvsVmServiceStatus                              Get-PvsVmServiceStatus [-AdminAddress <String>] ...
Cmdlet          Get-PvsVmTask                                       Get-PvsVmTask [[-TaskId] <Guid>] [-Type <JobType...
Cmdlet          Get-PvsVmVirtualMachine                             Get-PvsVmVirtualMachine [-OutOfDate] [-VmId <Str...
Cmdlet          Group-BrokerDesktop                                 Group-BrokerDesktop [[-MachineName] <String>] -P...
Cmdlet          Import-BrokerDesktopPolicy                          Import-BrokerDesktopPolicy [-Policy] <Byte[]> [-...
Cmdlet          Lock-ProvVM                                         Lock-ProvVM [-VMID] <String[]> -ProvisioningSche...
Cmdlet          New-AcctADAccount                                   New-AcctADAccount [-IdentityPoolName] <String> -...
Cmdlet          New-AcctAdministrator                               New-AcctAdministrator [-Account] <String> [-Read...
Cmdlet          New-AcctIdentityPool                                New-AcctIdentityPool -IdentityPoolName <String> ...
Cmdlet          New-BrokerAccessPolicyRule                          New-BrokerAccessPolicyRule [-Name] <String> [-Al...
Cmdlet          New-BrokerAdministrator                             New-BrokerAdministrator [-BrokerAdmin] [-Enabled...
Cmdlet          New-BrokerApp                                       New-BrokerApp [-DisplayName] <String> [-CommandL...
Cmdlet          New-BrokerApplication                               New-BrokerApplication [-ApplicationType <Applica...
Cmdlet          New-BrokerApplicationFolder                         New-BrokerApplicationFolder [-Name] <String> [-D...
Cmdlet          New-BrokerAssignmentPolicyRule                      New-BrokerAssignmentPolicyRule [-Name] <String> ...
Cmdlet          New-BrokerCatalog                                   New-BrokerCatalog [-Name] <String> -AllocationTy...
Cmdlet          New-BrokerConfiguredFTA                             New-BrokerConfiguredFTA -ApplicationUid <Int32> ...
Cmdlet          New-BrokerDelayedHostingPowerAction                 New-BrokerDelayedHostingPowerAction [-MachineNam...
Cmdlet          New-BrokerDesktopGroup                              New-BrokerDesktopGroup [-Name] <String> [-Automa...
Cmdlet          New-BrokerEntitlementPolicyRule                     New-BrokerEntitlementPolicyRule [-Name] <String>...
Cmdlet          New-BrokerHostingPowerAction                        New-BrokerHostingPowerAction [-MachineName] <Str...
Cmdlet          New-BrokerHypervisorConnection                      New-BrokerHypervisorConnection [-HypHypervisorCo...
Cmdlet          New-BrokerIcon                                      New-BrokerIcon [-EncodedIconData] <String> [-Adm...
Cmdlet          New-BrokerMachine                                   New-BrokerMachine [-MachineName] <String> [-Assi...
Cmdlet          New-BrokerPowerTimeScheme                           New-BrokerPowerTimeScheme [-Name] <String> -Days...
Cmdlet          New-BrokerTag                                       New-BrokerTag [-Name] <String> [-UUID <Guid>] [-...
Cmdlet          New-BrokerUser                                      New-BrokerUser [-SID] <SecurityIdentifier> [-Adm...
Cmdlet          New-ConfigAdministrator                             New-ConfigAdministrator [-Account] <String> [-Re...
Cmdlet          New-CtxInformationPackage                           New-CtxInformationPackage [-SupportNumber] <Stri...
Cmdlet          New-HypAdministrator                                New-HypAdministrator [-Account] <String> [-ReadO...
Cmdlet          New-HypVMSnapshot                                   New-HypVMSnapshot [-LiteralPath] <String> [-Snap...
Cmdlet          New-ProvAdministrator                               New-ProvAdministrator [-Account] <String> [-Read...
Cmdlet          New-ProvScheme                                      New-ProvScheme [-ProvisioningSchemeName] <String...
Cmdlet          New-ProvVM                                          New-ProvVM -ProvisioningSchemeName <String> -ADA...
Cmdlet          New-PvsVmAdministrator                              New-PvsVmAdministrator [-Account] <String> [-Rea...
Cmdlet          Publish-ProvMasterVmImage                           Publish-ProvMasterVmImage [-ProvisioningSchemeNa...
Cmdlet          Register-ConfigServiceInstance                      Register-ConfigServiceInstance -ServiceGroupUid ...
Cmdlet          Remove-AcctADAccount                                Remove-AcctADAccount [-IdentityPoolName] <String...
Cmdlet          Remove-AcctAdministrator                            Remove-AcctAdministrator [-Account] <String> [-A...
Cmdlet          Remove-AcctIdentityPool                             Remove-AcctIdentityPool [-IdentityPoolName] <Str...
Cmdlet          Remove-AcctTask                                     Remove-AcctTask [-TaskId] <Guid> [-AdminAddress ...
Cmdlet          Remove-AcctTaskMetadata                             Remove-AcctTaskMetadata [-TaskId] <Guid> [[-Prop...
Cmdlet          Remove-BrokerAccessPolicyRule                       Remove-BrokerAccessPolicyRule [-InputObject] <Ac...
Cmdlet          Remove-BrokerAdministrator                          Remove-BrokerAdministrator [-InputObject] <Admin...
Cmdlet          Remove-BrokerApplication                            Remove-BrokerApplication [-InputObject] <Applica...
Cmdlet          Remove-BrokerApplicationFolder                      Remove-BrokerApplicationFolder [-InputObject] <A...
Cmdlet          Remove-BrokerAssignmentPolicyRule                   Remove-BrokerAssignmentPolicyRule [-InputObject]...
Cmdlet          Remove-BrokerCatalog                                Remove-BrokerCatalog [-InputObject] <Catalog[]> ...
Cmdlet          Remove-BrokerConfiguredFTA                          Remove-BrokerConfiguredFTA [-InputObject] <Confi...
Cmdlet          Remove-BrokerDelayedHostingPowerAction              Remove-BrokerDelayedHostingPowerAction [-InputOb...
Cmdlet          Remove-BrokerDesktopGroup                           Remove-BrokerDesktopGroup [-InputObject] <Deskto...
Cmdlet          Remove-BrokerEntitlementPolicyRule                  Remove-BrokerEntitlementPolicyRule [-InputObject...
Cmdlet          Remove-BrokerHostingPowerAction                     Remove-BrokerHostingPowerAction [-InputObject] <...
Cmdlet          Remove-BrokerHypervisorConnection                   Remove-BrokerHypervisorConnection [-InputObject]...
Cmdlet          Remove-BrokerIcon                                   Remove-BrokerIcon [-InputObject] <Icon[]> [-Admi...
Cmdlet          Remove-BrokerImportedFTA                            Remove-BrokerImportedFTA -AppDesktopGroupUids <I...
Cmdlet          Remove-BrokerMachine                                Remove-BrokerMachine [-InputObject] <Machine[]> ...
Cmdlet          Remove-BrokerPowerTimeScheme                        Remove-BrokerPowerTimeScheme [-InputObject] <Pow...
Cmdlet          Remove-BrokerTag                                    Remove-BrokerTag [-InputObject] <Tag[]> [-Deskto...
Cmdlet          Remove-BrokerUser                                   Remove-BrokerUser [-InputObject] <User[]> [-Mach...
Cmdlet          Remove-ConfigAdministrator                          Remove-ConfigAdministrator [-Account] <String> [...
Cmdlet          Remove-ConfigGlobalMetadata                         Remove-ConfigGlobalMetadata [[-Property] <String...
Cmdlet          Remove-ConfigRegisteredServiceInstanceMetadata      Remove-ConfigRegisteredServiceInstanceMetadata [...
Cmdlet          Remove-ConfigServiceGroup                           Remove-ConfigServiceGroup [-ServiceGroupUid] <Gu...
Cmdlet          Remove-ConfigServiceGroupMetadata                   Remove-ConfigServiceGroupMetadata [-ServiceGroup...
Cmdlet          Remove-ConfigTask                                   Remove-ConfigTask [-TaskId] <Guid> [-AdminAddres...
Cmdlet          Remove-ConfigTaskMetadata                           Remove-ConfigTaskMetadata [-TaskId] <Guid> [[-Pr...
Cmdlet          Remove-HypAdministrator                             Remove-HypAdministrator [-Account] <String> [-Ad...
Cmdlet          Remove-HypHostingUnitStorage                        Remove-HypHostingUnitStorage [-LiteralPath] <Str...
Cmdlet          Remove-HypHypervisorConnectionAddress               Remove-HypHypervisorConnectionAddress [-LiteralP...
Cmdlet          Remove-HypMetadata                                  Remove-HypMetadata [-LiteralPath] <String> [-Pro...
Cmdlet          Remove-HypTask                                      Remove-HypTask [-TaskId] <Guid> [-AdminAddress <...
Cmdlet          Remove-HypTaskMetadata                              Remove-HypTaskMetadata [-TaskId] <Guid> [[-Prope...
Cmdlet          Remove-ProvAdministrator                            Remove-ProvAdministrator [-Account] <String> [-A...
Cmdlet          Remove-ProvScheme                                   Remove-ProvScheme [-ProvisioningSchemeName] <Str...
Cmdlet          Remove-ProvSchemeControllerAddress                  Remove-ProvSchemeControllerAddress [-Provisionin...
Cmdlet          Remove-ProvSchemeMasterVMImageHistory               Remove-ProvSchemeMasterVMImageHistory [-Provisio...
Cmdlet          Remove-ProvSchemeMetadata                           Remove-ProvSchemeMetadata [-ProvisioningSchemeNa...
Cmdlet          Remove-ProvTask                                     Remove-ProvTask [-TaskId] <Guid> [-AdminAddress ...
Cmdlet          Remove-ProvTaskMetadata                             Remove-ProvTaskMetadata [-TaskId] <Guid> [[-Prop...
Cmdlet          Remove-ProvVM                                       Remove-ProvVM [-ProvisioningSchemeName] <String>...
Cmdlet          Remove-PvsVmAdministrator                           Remove-PvsVmAdministrator [-Account] <String> [-...
Cmdlet          Remove-PvsVmTask                                    Remove-PvsVmTask [-TaskId] <Guid> [-AdminAddress...
Cmdlet          Remove-PvsVmTaskMetadata                            Remove-PvsVmTaskMetadata [-TaskId] <Guid> [[-Pro...
Cmdlet          Rename-AcctIdentityPool                             Rename-AcctIdentityPool [-IdentityPoolName] <Str...
Cmdlet          Rename-BrokerAccessPolicyRule                       Rename-BrokerAccessPolicyRule [-InputObject] <Ac...
Cmdlet          Rename-BrokerApplication                            Rename-BrokerApplication [-Application] <Applica...
Cmdlet          Rename-BrokerApplicationFolder                      Rename-BrokerApplicationFolder [-InputObject] <A...
Cmdlet          Rename-BrokerAssignmentPolicyRule                   Rename-BrokerAssignmentPolicyRule [-InputObject]...
Cmdlet          Rename-BrokerCatalog                                Rename-BrokerCatalog [-InputObject] <Catalog[]> ...
Cmdlet          Rename-BrokerDesktopGroup                           Rename-BrokerDesktopGroup [-InputObject] <Deskto...
Cmdlet          Rename-BrokerEntitlementPolicyRule                  Rename-BrokerEntitlementPolicyRule [-InputObject...
Cmdlet          Rename-BrokerPowerTimeScheme                        Rename-BrokerPowerTimeScheme [-InputObject] <Pow...
Cmdlet          Rename-BrokerTag                                    Rename-BrokerTag [-InputObject] <Tag[]> [-NewNam...
Cmdlet          Rename-ProvScheme                                   Rename-ProvScheme [-ProvisioningSchemeName] <Str...
Cmdlet          Repair-AcctADAccount                                Repair-AcctADAccount [-Password <String>] [-Secu...
Cmdlet          Reset-AcctServiceGroupMembership                    Reset-AcctServiceGroupMembership [-ConfigService...
Cmdlet          Reset-BrokerServiceGroupMembership                  Reset-BrokerServiceGroupMembership -ConfigServic...
Cmdlet          Reset-ConfigServiceGroupMembership                  Reset-ConfigServiceGroupMembership [-ConfigServi...
Cmdlet          Reset-HypServiceGroupMembership                     Reset-HypServiceGroupMembership [-ConfigServiceI...
Cmdlet          Reset-ProvServiceGroupMembership                    Reset-ProvServiceGroupMembership [-ConfigService...
Cmdlet          Reset-PvsVmServiceGroupMembership                   Reset-PvsVmServiceGroupMembership [-ConfigServic...
Cmdlet          Send-BrokerSessionMessage                           Send-BrokerSessionMessage [-InputObject] <Sessio...
Cmdlet          Set-AcctDBConnection                                Set-AcctDBConnection [-DBConnection] <String> [-...
Cmdlet          Set-AcctIdentityPool                                Set-AcctIdentityPool [-IdentityPoolName] <String...
Cmdlet          Set-BrokerAccessPolicyRule                          Set-BrokerAccessPolicyRule [-InputObject] <Acces...
Cmdlet          Set-BrokerAdministrator                             Set-BrokerAdministrator [-InputObject] <Administ...
Cmdlet          Set-BrokerApplication                               Set-BrokerApplication [-InputObject] <Applicatio...
Cmdlet          Set-BrokerApplicationFolder                         Set-BrokerApplicationFolder [-InputObject] <Appl...
Cmdlet          Set-BrokerAssignmentPolicyRule                      Set-BrokerAssignmentPolicyRule [-InputObject] <A...
Cmdlet          Set-BrokerCatalog                                   Set-BrokerCatalog [-InputObject] <Catalog[]> [-P...
Cmdlet          Set-BrokerDBConnection                              Set-BrokerDBConnection -DBConnection <String> [-...
Cmdlet          Set-BrokerDesktopGroup                              Set-BrokerDesktopGroup [-InputObject] <DesktopGr...
Cmdlet          Set-BrokerEntitlementPolicyRule                     Set-BrokerEntitlementPolicyRule [-InputObject] <...
Cmdlet          Set-BrokerHostingPowerAction                        Set-BrokerHostingPowerAction [-InputObject] <Hos...
Cmdlet          Set-BrokerHypervisorConnection                      Set-BrokerHypervisorConnection [-InputObject] <H...
Cmdlet          Set-BrokerMachine                                   Set-BrokerMachine [-InputObject] <Machine[]> [-P...
Cmdlet          Set-BrokerPowerTimeScheme                           Set-BrokerPowerTimeScheme [-InputObject] <PowerT...
Cmdlet          Set-BrokerPrivateAppDesktop                         Set-BrokerPrivateAppDesktop [-InputObject] <Priv...
Cmdlet          Set-BrokerPrivateDesktop                            Set-BrokerPrivateDesktop [-InputObject] <Private...
Cmdlet          Set-BrokerSharedAppDesktop                          Set-BrokerSharedAppDesktop [-InputObject] <Share...
Cmdlet          Set-BrokerSharedDesktop                             Set-BrokerSharedDesktop [-InputObject] <SharedDe...
Cmdlet          Set-BrokerSite                                      Set-BrokerSite [-PassThru] [-ApplicationIconUid ...
Cmdlet          Set-ConfigDBConnection                              Set-ConfigDBConnection [-DBConnection] <String> ...
Cmdlet          Set-ConfigRegisteredServiceInstance                 Set-ConfigRegisteredServiceInstance -ServiceInst...
Cmdlet          Set-HypAdminConnection                              Set-HypAdminConnection [-AdminAddress <String>] ...
Cmdlet          Set-HypDBConnection                                 Set-HypDBConnection [-DBConnection] <String> [-A...
Cmdlet          Set-ProvDBConnection                                Set-ProvDBConnection [-DBConnection] <String> [-...
Cmdlet          Set-ProvScheme                                      Set-ProvScheme [-ProvisioningSchemeName] <String...
Cmdlet          Set-PvsVmDBConnection                               Set-PvsVmDBConnection [-DBConnection] <String> [...
Cmdlet          Start-CtxTraceSession                               Start-CtxTraceSession [-TraceProviders] <CtxTrac...
Cmdlet          Stop-AcctTask                                       Stop-AcctTask [-TaskId] <Guid> [-AdminAddress <S...
Cmdlet          Stop-BrokerSession                                  Stop-BrokerSession [-InputObject] <Session[]> [-...
Cmdlet          Stop-ConfigTask                                     Stop-ConfigTask [-TaskId] <Guid> [-AdminAddress ...
Cmdlet          Stop-CtxTraceSession                                Stop-CtxTraceSession [[-ServerName] <String[]>] ...
Cmdlet          Stop-HypTask                                        Stop-HypTask [-TaskId] <Guid> [-AdminAddress <St...
Cmdlet          Stop-ProvTask                                       Stop-ProvTask [-TaskId] <Guid> [-AdminAddress <S...
Cmdlet          Stop-PvsVmTask                                      Stop-PvsVmTask [-TaskId] <Guid> [-AdminAddress <...
Cmdlet          Switch-AcctTask                                     Switch-AcctTask [-Host2] <String> [-AdminAddress...
Cmdlet          Switch-ConfigTask                                   Switch-ConfigTask [-Host2] <String> [-AdminAddre...
Cmdlet          Switch-HypTask                                      Switch-HypTask [-Host2] <String> [-AdminAddress ...
Cmdlet          Switch-ProvTask                                     Switch-ProvTask [-Host2] <String> [-AdminAddress...
Cmdlet          Switch-PvsVmTask                                    Switch-PvsVmTask [-Host2] <String> [-AdminAddres...
Cmdlet          Test-ConfigServiceInstanceAvailability              Test-ConfigServiceInstanceAvailability [-Service...
Cmdlet          Unlock-AcctADAccount                                Unlock-AcctADAccount -ADAccountName <String> [-A...
Cmdlet          Unlock-AcctIdentityPool                             Unlock-AcctIdentityPool [-IdentityPoolName] <Str...
Cmdlet          Unlock-ProvScheme                                   Unlock-ProvScheme [-ProvisioningSchemeName] <Str...
Cmdlet          Unlock-ProvVM                                       Unlock-ProvVM [-VMID] <String[]> -ProvisioningSc...
Cmdlet          Unregister-ConfigRegisteredServiceInstance          Unregister-ConfigRegisteredServiceInstance [-Ser...
Cmdlet          Update-AcctADAccount                                Update-AcctADAccount [-IdentityPoolName] <String...
Cmdlet          Update-BrokerImportedFTA                            Update-BrokerImportedFTA -AppDesktopUids <Int32[...
Cmdlet          Update-BrokerNameCache                              Update-BrokerNameCache [-Machines] [-Users] [-Ad...

 

If you have some issue with the security in PowerShell, refer to the build-in help to set the proper level of execution security. To go further with all these Cmdlet, Citrix have online a webpage : CTX127254 where you can read and learn more about each Cmdlet.

I made 3 scripts to get the information (1), inject the new information in the database (2) and configure the DDC (3) these script will be executed by Altiris remotly on the new DDC (1 & 3) and on the SQL Server (2)

  1. 1_XD5_ADD_CONTROLLER_DB.ps1
  2. 2_XD5_ADD_CONTROLLER_DB.cmd
  3. 3_XD5_ADD_CONTROLLER_CONFIG.ps1

First PowerShell script to extract some information and prepare the injection in the SQL Database, execute this script on the new XenDesktop DDC, you’ll need to change the value for the first lines and put yours. To get the information you’ll need if you don’t know where to search for, you can find the value you need for $cs by running the PowerShell command Get-ConfigDBConnection, for $adminUser use the Get-ConfigAdministrator; for $xd_dbname use the Initial Catalog value you have in $cs and foe the last value $xd_sitename use the Get-BrokerSite PowerShell command and copy the name value in the script.

Asnp Citrix.*
 
$cs = 'Server=SUOMIAPP01.SUOMI.INC;Initial Catalog = SUOMI_XD5; Integrated Security =True'
$adminUser = 'SUOMI.INC\Administrator'
$xd_dbname = 'SUOMI_XD5'
$xd_sitename = 'Saint-Germain-en-Laye'
 
Get-ConfigDBSchema -DatabaseName $xd_dbname -ServiceGroupName $xd_sitename -ScriptType Instance > \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_config.sql
Get-AcctDBSchema -DatabaseName $xd_dbname -ServiceGroupName $xd_sitename -ScriptType Instance > \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_acct.sql
Get-HypDBSchema -DatabaseName $xd_dbname -ServiceGroupName $xd_sitename -ScriptType Instance > \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_hyp.sql
Get-ProvDBSchema -DatabaseName $xd_dbname -ServiceGroupName $xd_sitename -ScriptType Instance > \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_prov.sql
Get-PvsVmDBSchema -DatabaseName $xd_dbname -ServiceGroupName $xd_sitename -ScriptType Instance > \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_pvs.sql
Get-BrokerDBSchema -DatabaseName $xd_dbname -ScriptType Instance > \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_broker.sql

The batch script to execute against the database server, run it on the SQL Server or remotly against the SQL Server :

sqlcmd -i \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_acct.sql -o \\SUOMIDC01\Apps\Scripts\XD5_Scripts\LOGS\xd_acct.txt
sqlcmd -i \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_broker.sql -o \\SUOMIDC01\Apps\Scripts\XD5_Scripts\LOGS\xd_borker.txt
sqlcmd -i \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_config.sql -o \\SUOMIDC01\Apps\Scripts\XD5_Scripts\LOGS\xd_config.txt
sqlcmd -i \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_hyp.sql -o \\SUOMIDC01\Apps\Scripts\XD5_Scripts\LOGS\xd_hyp.txt
sqlcmd -i \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_prov.sql -o \\SUOMIDC01\Apps\Scripts\XD5_Scripts\LOGS\xd_prov.txt
sqlcmd -i \\SUOMIDC01\Apps\Scripts\XD5_Scripts\xd_pvs.sql -o \\SUOMIDC01\Apps\Scripts\XD5_Scripts\LOGS\xd_pvs.txt

And finaly the PowerShell script to configure the new Desktop Delivery Controler, run it on the new XenDesktop DDC. To get the information you’ll need if you don’t know where to search for, you can find the value you need for $cs by running the PowerShell command Get-ConfigDBConnection, for $adminUser use the Get-ConfigAdministrator; for $xd_dbname use the Initial Catalog value you have in $cs and foe the last value $xd_sitename use the Get-BrokerSite PowerShell command and copy the name value in the script.

Asnp Citrix.*
 
$cs = 'Server=SUOMIAPP01.SUOMI.INC;Initial Catalog = SUOMI_XD5; Integrated Security =True'
$adminUser = 'SUOMI.INC\Administrator'
$xd_dbname = 'SUOMI_XD5'
$xd_sitename = 'Saint-Germain-en-Laye'
 
Set-ConfigDBConnection -DBConnection $null
Set-AcctDBConnection -DBConnection $null
Set-HypDBConnection -DBConnection $null
Set-ProvDBConnection -DBConnection $null
Set-PvsVmDBConnection -DBConnection $null
Set-BrokerDBConnection -DBConnection $null
 
Set-ConfigDBConnection -DBConnection $cs
Set-AcctDBConnection -DBConnection $cs
Set-HypDBConnection -DBConnection $cs
Set-ProvDBConnection -DBConnection $cs
Set-PvsVmDBConnection -DBConnection $cs
Set-BrokerDBConnection -DBConnection $cs
 
Get-ConfigServiceInstance | Register-ConfigServiceInstance
Get-ConfigRegisteredServiceInstance | Reset-ConfigServiceGroupMembership
 
Get-HypServiceInstance | Register-ConfigServiceInstance
Get-ConfigRegisteredServiceInstance | Reset-HypServiceGroupMembership
 
Get-AcctServiceInstance | Register-ConfigServiceInstance
Get-ConfigRegisteredServiceInstance | Reset-AcctServiceGroupMembership
 
Get-PvsVmServiceInstance | Register-ConfigServiceInstance
Get-ConfigRegisteredServiceInstance | Reset-PvsVmServiceGroupMembership
 
Get-ProvServiceInstance | Register-ConfigServiceInstance
Get-ConfigRegisteredServiceInstance | Reset-ProvServiceGroupMembership
 
Get-BrokerServiceInstance | Register-ConfigServiceInstance
Get-ConfigServiceInstance | Reset-BrokerServiceGroupMembership
 
New-BrokerAdministrator -BrokerAdmin $False -Enabled $True -FullAdmin $True -Name $adminUser -ProvisioningAdmin $False -ReadOnly $False
 
Remove-AcctAdministrator -Account $adminUser
Remove-PvsVmAdministrator -Account $adminUser
Remove-ConfigAdministrator -Account $adminUser
Remove-HypAdministrator -Account $adminUser
Remove-ProvAdministrator -Account $adminUser
 
New-AcctAdministrator -Account $adminUser
New-PvsVmAdministrator -Account $adminUser
New-ConfigAdministrator -Account $adminUser
New-HypAdministrator -Account $adminUser
New-ProvAdministrator -Account $adminUser

The script execution order is important, with industrialization software, you can very easily order these scripts and now deploy thousand of XenDesktop on you sites. You might have one error during script execution, this is because the account you set in the script is already an administrator on the XenDesktop site, everything will continue until the end after this error.

You can check if your new XenDesktop server is well configured by running the PowerShell Cmdlet Get-BrokerController, you should have a result which look like that :

and you can also check with Desktop Studio on the main screen at the bottom:

I know this script is not perfect, I know I will adapt and change it very soon and I will keep update this blog to explain the changes I did and why I did it. I found a lot of help on the Citrix forums, especially post from Andrew Ogle (Citrite).

I still need to figure out how to go deeper in the configuration of a new controller (DDC) but arrived that far it shouldn’t be very difficult. I will update this blog as soon as I go deeper in Citrix XenDesktop 5 automation / industrialization

Ressources:
Citrix XenDesktop 5 eDocs
XenDesktop 5 SDK command line reference

Post author