Advertisement
henrydenhengst

Install XenDesktop Server 7.x

May 6th, 2015
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #######################################################################################
  2. #
  3. # Create XenDesktop Site with 3 separate databases
  4. # Source: http://blogs.citrix.com/2013/10/02/xendesktop-7-site-creation-via-powershell/
  5. # Software ISO download at http://www.citrix.com/downloads.html
  6. #
  7. # I have not yet tested this script, I will document this script later with
  8. # extra comments and code and might use this blog
  9. # http://www.archy.net/citrix-xendesktop-7-unattended-installation-site-join/
  10. # to polish and finish the script.
  11. #
  12. #######################################################################################
  13.  
  14. Import-Module Citrix.XenDesktop.Admin
  15. Add-PSSnapin Citrix.*
  16.  
  17. # Parameters ###############################
  18.  
  19. $DatabaseServer = "dbserver.denhengst.local"
  20. $DatabaseName_Site = "XD7-DB_Site"
  21. $DatabaseName_Logging = "XD7-DB_Logging"
  22. $DatabaseName_Monitor = "XD7-DB_Monitor"
  23.  
  24. $XD7Site = "XD7Site"
  25.  
  26. $FullAdminGroup = "denhengst\FullAdminGroup"
  27.  
  28. $LicenseServer = "licenseserver.denhengst.local"
  29.  
  30. $LicenseServer_LicensingModel = "UserDevice"
  31. $LicenseServer_ProductCode = "XDT"
  32. $LicenseServer_ProductEdition = "PLT"
  33.  
  34. ############################################
  35.  
  36. $DatabaseUser = Read-Host "Please enter user for database connection (denhengst\Username)"
  37. $DatabasePassword = Read-Host "Please enter password for user $DatabaseUser" -AsSecureString
  38.  
  39. $Database_CredObject = New-Object System.Management.Automation.PSCredential($DatabaseUser,$DatabasePassword)
  40.  
  41. # Create Databases
  42.  
  43. New-XDDatabase -AdminAddress $env:COMPUTERNAME -SiteName $XD7Site -DataStore Site -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName_Site -DatabaseCredentials $Database_CredObject
  44. New-XDDatabase -AdminAddress $env:COMPUTERNAME -SiteName $XD7Site -DataStore Logging -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName_Logging -DatabaseCredentials $Database_CredObject
  45. New-XDDatabase -AdminAddress $env:COMPUTERNAME -SiteName $XD7Site -DataStore Monitor -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName_Monitor -DatabaseCredentials $Database_CredObject
  46.  
  47. # Create Site
  48.  
  49. New-XDSite -DatabaseServer $DatabaseServer -LoggingDatabaseName $DatabaseName_Logging -MonitorDatabaseName $DatabaseName_Monitor -SiteDatabaseName $DatabaseName_Site -SiteName $XD7Site -AdminAddress $env:COMPUTERNAME
  50.  
  51. # ConfigureLicensing and confirm the certificate hash
  52.  
  53. Set-XDLicensing -AdminAddress $env:COMPUTERNAME -LicenseServerAddress $LicenseServer -LicenseServerPort 27000
  54. Set-ConfigSite  -AdminAddress $env:COMPUTERNAME -LicensingModel $LicenseServer_LicensingModel -ProductCode $LicenseServer_ProductCode -ProductEdition $LicenseServer_ProductEdition
  55. Set-ConfigSiteMetadata -AdminAddress $env:COMPUTERNAME -Name 'CertificateHash' -Value $(Get-LicCertificate -AdminAddress "https://$LicenseServer").CertHash
  56.  
  57. # Add admin group to full admins
  58.  
  59. New-AdminAdministrator -AdminAddress $env:COMPUTERNAME -Name $FullAdminGroup
  60. Add-AdminRight -AdminAddress $env:COMPUTERNAME -Administrator $FullAdminGroup -Role 'Full Administrator' -All
  61.  
  62. <# 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