Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #######################################################################################
- #
- # Create XenDesktop Site with 3 separate databases
- # Source: http://blogs.citrix.com/2013/10/02/xendesktop-7-site-creation-via-powershell/
- # Software ISO download at http://www.citrix.com/downloads.html
- #
- # I have not yet tested this script, I will document this script later with
- # extra comments and code and might use this blog
- # http://www.archy.net/citrix-xendesktop-7-unattended-installation-site-join/
- # to polish and finish the script.
- #
- #######################################################################################
- Import-Module Citrix.XenDesktop.Admin
- Add-PSSnapin Citrix.*
- # Parameters ###############################
- $DatabaseServer = "dbserver.denhengst.local"
- $DatabaseName_Site = "XD7-DB_Site"
- $DatabaseName_Logging = "XD7-DB_Logging"
- $DatabaseName_Monitor = "XD7-DB_Monitor"
- $XD7Site = "XD7Site"
- $FullAdminGroup = "denhengst\FullAdminGroup"
- $LicenseServer = "licenseserver.denhengst.local"
- $LicenseServer_LicensingModel = "UserDevice"
- $LicenseServer_ProductCode = "XDT"
- $LicenseServer_ProductEdition = "PLT"
- ############################################
- $DatabaseUser = Read-Host "Please enter user for database connection (denhengst\Username)"
- $DatabasePassword = Read-Host "Please enter password for user $DatabaseUser" -AsSecureString
- $Database_CredObject = New-Object System.Management.Automation.PSCredential($DatabaseUser,$DatabasePassword)
- # Create Databases
- 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
- # Create Site
- New-XDSite -DatabaseServer $DatabaseServer -LoggingDatabaseName $DatabaseName_Logging -MonitorDatabaseName $DatabaseName_Monitor -SiteDatabaseName $DatabaseName_Site -SiteName $XD7Site -AdminAddress $env:COMPUTERNAME
- # ConfigureLicensing and confirm the certificate hash
- Set-XDLicensing -AdminAddress $env:COMPUTERNAME -LicenseServerAddress $LicenseServer -LicenseServerPort 27000
- Set-ConfigSite -AdminAddress $env:COMPUTERNAME -LicensingModel $LicenseServer_LicensingModel -ProductCode $LicenseServer_ProductCode -ProductEdition $LicenseServer_ProductEdition
- Set-ConfigSiteMetadata -AdminAddress $env:COMPUTERNAME -Name 'CertificateHash' -Value $(Get-LicCertificate -AdminAddress "https://$LicenseServer").CertHash
- # Add admin group to full admins
- New-AdminAdministrator -AdminAddress $env:COMPUTERNAME -Name $FullAdminGroup
- Add-AdminRight -AdminAddress $env:COMPUTERNAME -Administrator $FullAdminGroup -Role 'Full Administrator' -All
- <# This software / sample code is provided to you “AS IS” with no representations, warranties or conditions of any kind. You may use, modify and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software / sample code may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software / sample code fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software / sample code. In no event should the software / code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE software / SAMPLE CODE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Although the copyright in the software / code belongs to Citrix, any distribution of the code should include only your own standard copyright attribution, and not that of Citrix. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code. #>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement