Stéphane Thirion
  • Home
  • Consulting – Raidho
  • homelab
3K
0
0
0
Stéphane Thirion
Stéphane Thirion
  • Home
  • Consulting – Raidho
  • homelab
  • Citrix
  • Microsoft
  • PowerShell
  • Provisioning Services
  • VMware
  • vSphere
  • Windows 2008 R2
  • Windows 2012
  • XenDesktop
  • XenServer

Citrix XenDesktop 7 – Create Persistent Hypervisor Connection and Hosting Unit, Unattended

  • July 8, 2013
  • Stephane Thirion
Total
0
Shares
0
0
0
0
0
0
0

I blogged about how to automate Citrix XenDesktop 7 deployment and database creation, and how to join and existing XenDesktop 7 site unattended, but now to continue and go a bit further in the automation process, I needed and wanted to know how to automate Hosting Configuration by Adding Connection and Resources to the DDC in an unattended way.

This blog will cover creation process for XenServer 6.x and vCenter (vSphere) 5.1 since I don’t have access to a Hyper-V (yet), I went over Citrix eDoc to check how I could do this and I found here : [link]

Thanks to Livio for some PowerShell help 🙂

Source code   
To Create a Persistent Hypervisor Connection
 
        new-item -path "xdhyp:Connections" -Name MyConn -ConnectionType
            XenServer -HypervisorAddress "http:address" -UserName user
            -Password password -Persist
 
        PSPath:                   Citrix.HostingUnitService.Admin.V1.0
                                  Citrix.Hypervisor::XDHyp:ConnectionsMyConn
        PSParentPath:             Citrix.HostingUnitService.Admin.V1.0
                                  Citrix.Hypervisor::XDHyp:Connections
        PSChildName:              MyConn
        PSDrive:                  XDHyp
        PSProvider:               Citrix.HostingUnitService.Admin.V1.0
                                  Citrix.Hypervisor
        PSIsContainer:            True
        HypervisorConnectionUid:  04e6daa2-5cbd-4491-b70c-6daf733ee82a
        HypervisorConnectionName: MyConn
        ConnectionType:           XenServer
        HypervisorAddress:        {http:address}
        UserName:                 user
        Persistent:               True
        PluginId:                 XenFactory
        SupportsPvsVMs:           True
        Revision:                 1b0b0d02-bc1b-49d8-b2b0-be6fb7f150ad
        MaintenanceMode:          False
        Metadata:                 {MaxAbsoluteActiveActions = 100,
                                  MaxAbsoluteNewActionsPerMinute = 100,
                                  MaxPowerActionsPercentageOfDesktops = 20}
 
    To Create a Hosting Unit
 
        new-item -Path "xdhyp:HostingUnits"
            -Name MyHU
            -HypervisorConnectionName MyConn
            -RootPath XDHYP:ConnectionsMyConn
            -NetworkPath XDHYP:ConnectionsMyConnNetwork 0.network
            -StoragePath XDHYP:ConnectionsMyConnLocal storage on
            myXenServer.storage
 
        PSPath:               Citrix.HostingUnitService.Admin.V1.0
                              Citrix.Hypervisor::XDHyp:HostingUnitsMyHU
        PSParentPath:         Citrix.HostingUnitService.Admin.V1.0
                              Citrix.Hypervisor::XDHyp:HostingUnits
        PSChildName:          MyHU
        PSDrive:              XDHyp
        PSProvider:           Citrix.HostingUnitService.Admin.V1.0
                              Citrix.Hypervisor
        PSIsContainer:        True
        HostingUnitUid:       df91f886-1141-4280-bd59-2ee260a4df79
        HostingUnitName:      MyHU
        HypervisorConnection: MyConn
        RootPath:             /
        RootId:
        NetworkPath:          /Network 0.network
        NetworkId:            ab47080b-ca15-771a-c8dc-6ad9650158f1
        Storage:              {/Local storage on myXenServer.storage}
        VMTaggingEnabled:     True
        Metadata:             {}
 
        Relative paths can be used for all parameters.

It helps to understand whet need to be setup and after few tests I ended up writing this script to automate this part :

XD7_HypHostAuto.ps1   
###############################################
#
# Stephane Thirion - www.archy.net - @archynet
# This script is part from the blog post :
# 
# 7th July 2013 - XenDesktop 7 automation - Tested with XenServer 6.2 and vmware vSphere 5.1
#
# Make changes in the top of the file to reflect your installation
# 
# $HypervisorAddress = "" use an IP or FQDN with http or https if you use vCenter, don't forget to add /sdk 
# $ConnectionType = "XenServer" for XenServer value = XenServer , vmware = VCenter
# $HypervisorConnectionName = "WhateverTheNameYouWantToUse"
# $Networkpath = "Host Networkname You Want To Use" Just copy and past from XenCenter
# $StoragePath = "Name of the Storage you want to use"  Just copy and past from XenCenter
# $PersonalvDiskStoragePath = "Name of the Storage you want to use for pvDisk"  Just copy and past from XenCenter
# $StorageNetworkResourceName = "WhateverTheNameYouWantToUse"
#
###############################################
$HypervisorAddress = ""
$ConnectionType = "XenServer"
$HypervisorConnectionName = "HypervisorFORXD7"
$Networkpath = "Bond 1+2"
$StoragePath = "NAS VDI"
$PersonalvDiskStoragePath = "NAS VDI"
$StorageNetworkResourceName = "StorageNetworkResourceXD7"
 
###############################################
# Hypervisor user credentials
###############################################
$HypervisorUser = "user"
$HypervisorPassword = "password"
 
###############################################
#
# DO NOT EDIT ANYTHING BELLOW THIS LINE
#
###############################################
# Create Connection 
###############################################
Get-ConfigServiceStatus  -AdminAddress $env:COMPUTERNAME
 
Get-LogSite  -AdminAddress $env:COMPUTERNAME
 
New-Item  -AdminAddress $env:COMPUTERNAME -ConnectionType $ConnectionType -HypervisorAddress @($HypervisorAddress) -Path xdhyp:connections$HypervisorConnectionName -Scope @() -Password $HypervisorPassword -UserName $HypervisorUser
 
###############################################
# Update Connection 
###############################################
Get-ConfigServiceStatus  -AdminAddress $env:COMPUTERNAME
 
Get-LogSite  -AdminAddress $env:COMPUTERNAME
 
Set-Item  -AdminAddress $env:COMPUTERNAME -PassThru -Path xdhyp:connections$HypervisorConnectionName -Password $HypervisorPassword -UserName $HypervisorUser
 
###############################################
# Create Resources and Persist Connection
###############################################
Get-ConfigServiceStatus  -AdminAddress $env:COMPUTERNAME
 
Get-LogSite  -AdminAddress $env:COMPUTERNAME
 
Get-Item  -AdminAddress $env:COMPUTERNAME -Path xdhyp:connections$HypervisorConnectionName
 
Remove-Item  -AdminAddress $env:COMPUTERNAME -Path xdhyp:connections$HypervisorConnectionName
 
New-Item  -AdminAddress $env:COMPUTERNAME -ConnectionType $ConnectionType -HypervisorAddress @($HypervisorAddress) -Path xdhyp:connections$HypervisorConnectionName -Persist -Scope @() -Password $HypervisorPassword -UserName $HypervisorUser
 
$HypervisorConnectionUid = (Get-Item  -AdminAddress $env:COMPUTERNAME -Path xdhyp:connections$HypervisorConnectionName).HypervisorConnectionUid.ToString()
 
New-BrokerHypervisorConnection  -AdminAddress $env:COMPUTERNAME -HypHypervisorConnectionUid $HypervisorConnectionUid
 
New-Item  -AdminAddress $env:COMPUTERNAME -HypervisorConnectionName $HypervisorConnectionName -NetworkPath xdhyp:connections$HypervisorConnectionName$NetworkPath.network -Path xdhyp:hostingunits$StorageNetworkResourceName -PersonalvDiskStoragePath xdhyp:connections$HypervisorConnectionName$PersonalvDiskStoragePath.storage -RootPath xdhyp:connections$HypervisorConnectionName -StoragePath xdhyp:connections$HypervisorConnectionName$StoragePath.storage

 

This script have been tested with Citrix XenDesktop7 and XenServer 6.2 and vSphere 5.1

Total
0
Shares
Tweet 0
Share 0
Share 0
Share 0
Share 0
Share 0
Share 0
Related Topics
  • Automate
  • automation
  • network
  • Provisioning Services
  • pvDisk
  • PVS
  • Storage
  • Unattended
  • vmware
  • vmware esx
  • vSphere
  • XenDesktop
  • XenDesktop 7
  • XenServer
  • XenServer 6.2
Stephane Thirion

Previous Article
  • Citrix
  • Experience
  • Windows 2008 R2
  • Windows 2012
  • XenDesktop

Citrix XenDesktop 7 – Unattended from scratch

  • July 5, 2013
  • Stephane Thirion
View Post
Next Article
  • Citrix
  • Experience
  • Microsoft
  • Windows 2008 R2
  • Windows 2012
  • Windows 7
  • Windows 8
  • Windows XP
  • XenApp
  • XenDesktop

Java Runtimes JRE7 – Your Java version is insecure popup

  • October 11, 2013
  • Stephane Thirion
View Post
You May Also Like
View Post
  • Active Directory
  • ADC
  • Citrix
  • Citrix Virtual Apps and Desktops
  • DaaS
  • Microsoft
  • NetScaler
  • Security

Netscaler native OTP Active Directory account delegation

  • Stephane Thirion
  • March 22, 2023
View Post
  • ADC
  • Citrix
  • NetScaler
  • SDX
  • Uncategorized

Invalid time in the Message sent by the Peer. Please ensure time synchronization between Netscaler and the Peer

  • Stephane Thirion
  • March 3, 2023
View Post
  • ADC
  • Citrix
  • NetScaler
  • SDX

Netscaler SDX LACP on 0/1 and 0/2 (Management Interfaces)

  • Stephane Thirion
  • March 2, 2023
View Post
  • Citrix
  • Citrix Virtual Apps and Desktops
  • Cloud
  • DaaS
  • Microsoft
  • PowerShell
  • VMware
  • vSphere

Create vmware service account for MCS Citrix

  • Stephane Thirion
  • February 28, 2023
View Post
  • Experience
  • Linux
  • VMware
  • vSphere

multipathd errors in /var/log/syslog

  • Stephane Thirion
  • August 2, 2022
View Post
  • Citrix
  • CTP
  • Uncategorized

This is the end of an era

  • Stephane Thirion
  • February 16, 2022
View Post
  • VMware
  • vSphere
  • Windows 2022

Migrating FSMO roles Windows 2022 Server

  • Stephane Thirion
  • January 3, 2022
View Post
  • ADC
  • Experience
  • Linux

Cloud yes but no, thanks (there is some Citrix)

  • Stephane Thirion
  • December 7, 2021
vmware
Binance – Affiliated link
Coinbase – Affiliated link
Blog Stats
  • 1,239,194 hits
Categories
  • Amazon (1)
  • Apple (20)
    • iOS (5)
    • Mac OSx (11)
  • ArchY.net Site (30)
  • Azure (8)
  • Certifications (3)
  • Citrix (211)
    • ADC (4)
    • Citrix Virtual Apps and Desktops (5)
    • DaaS (2)
    • NetScaler (15)
    • Password Manager (3)
    • Personal vDisk (5)
    • Power and Capacity Management (3)
    • Provisioning Services (22)
    • Receiver (29)
    • SDX (2)
    • ShareFile (8)
    • Single Sign On (3)
    • SmartAuditor (2)
    • Storefront (12)
    • Synergy (25)
    • User Profile Management (2)
    • VDI (7)
    • WebInterface (21)
    • XenApp (84)
    • XenApp Plugin (3)
    • XenClient (10)
    • XenDesktop (55)
    • XenServer (42)
  • Cloud (13)
  • Crystal Ball (2)
  • CTP (13)
  • Docker (2)
  • Events (35)
    • E2E – PubForum (9)
    • Geek Speak (3)
  • Experience (53)
  • Kubernetes (2)
  • Licensing (3)
  • Linux (12)
  • Microsoft (147)
    • Active Directory (1)
    • Azure (8)
    • Office365 (4)
    • PowerShell (19)
    • RDS (5)
    • Windows 10 (6)
    • Windows 2003 (21)
    • Windows 2008 (20)
    • Windows 2008 R2 (54)
    • Windows 2012 (13)
    • Windows 2012R2 (13)
    • Windows 2016 (18)
    • Windows 2019 (4)
    • Windows 2022 (1)
    • Windows 7 (27)
    • Windows 8 (19)
    • Windows Virtual Desktop (1)
    • Windows XP (11)
  • News (5)
  • Raidho (2)
  • Raspberry (3)
  • Scripting (13)
  • Security (5)
  • Slide Deck (1)
  • Thin Clients (3)
  • Twitter (1)
  • Ubiquiti (1)
  • Uncategorized (13)
  • VMware (28)
    • VMWare WorkStation (2)
    • vSphere (16)
Stéphane Thirion
Don't Follow the Trend

Input your search keywords and press Enter.