Jump to content
Welcome to our new Citrix community!
  • Guidelines for Migration of CVAD On-Prem to Citrix DaaS–Control Layer: Part 3


    cugcblogs

    UddaveJajoo22Rnd.png by Uddave Jajoo, Indianapolis CUGC Leader

    This post continues the series covering Citrix Control Layer Migration to Citrix Cloud – Guidelines for Migration from CVAD on Prem to Citrix DAAS – Control Layer: Part 1 & Guidelines for Migration from CVAD On-Prem to Citrix DAAS – Control Layer: Part 2.

    In this post, I focus on the process of cutover the on-prem workloads from DDCs to Cloud Connectors for respective resource locations.

    Following your migration of Site Data Configuration to Citrix Cloud, now actually comes the major task to switch VDAs pointing to on-prem DDCs to Citrix Cloud Connectors for both list of DDCs and WEM config.

    Control Layer: Part 3

    Cutover on-prem workloads to Citrix Cloud Connectors

    As part of the cutover from on-prem DDCs to Citrix Cloud, I would like to showcase a simple script that will ease the work for all the DaaS admins and help reduce some Opex and Capex Costs. This script can be executed locally or remotely on VDAs to perform the switch.

    If the deployment also involves WEM, then use both the functions Config-DDC() & Config-WEM() mentioned below, and if just for list of DDCs change refer function to Config-DDC()

    Pre-requisites for script execution:

    1. Create a .txt file with list of VDAs with FQDN in the below format.
    jajoo012623-o01.jpg.20803685054b5395967484a9384f7662.jpg
    1. Script execution context should be System, and while invoking remote script please make sure the user account context should have remote administrator or Sys Admin permissions on the respective VDAs.

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Running Locally on the VDAs using ControlUp or any other tool available within your environment.

    <#.NOTESScript Name:.\SwitchOnPremResourcesToCloudConnectorsCurrent Version: 1.0Original Author: Uddave JajooThis script makes changes to the system registry and performs other configuration changes. As such a full backup of the machine or snapshot if running in a virtual environment is strongly recommended. Carry out full testing before introducing the optimized image to production.To avoid failure, run PowerShell as an administrator before running this script and make sure you are using the 64-bit version of PowerShell..SYNOPSIS Configure Citrix Cloud Connector on VDAs.DESCRIPTIONThis script will configure the Citrix Cloud Connector values for different regional locations on the VDA.USAGE.INPUTS         None.Example         .\SwitchOnPremResourcesToCloudConnectors.ps1.Outputs         None.STEPS EXPLAINED All steps in the script are described.PROMPTS.LIST OF PARAMETERS.CHANGE HISTORY:     Version    DATE         Modified by    Description of Change     v1.0       02 Dec 2021  Uddave Jajoo   New script to modify List of DDCs and WEM Server address on Prem Resources to Cloud Connectors===========================================================================#>$servername = $env:computername$DomainName = (Get-WmiObject Win32_ComputerSystem).domain.Split(".")[0]$hostname = [system.Net.Dns]::GetHostEntry([string]$env:computername).HostNameFunction Config-WEM(){       Try       {       Write-host  "Setting WEM server for the machine based on its domain" -foregroundcolor magenta switch($DomainName){       "Domain1" {$SetWEM = "DOMAIN3CLOUDCONNECTOR1.domain3.com,DOMAIN3CLOUDCONNECTOR2.domain3.com"}        "Domain2" {$SetWEM = "DOMAIN2CLOUDCONNECTOR1.domain2.com,DOMAIN2CLOUDCONNECTOR2.domain2.com"}       Default{$SetWEM = "DOMAIN1CLOUDCONNECTOR1.DOMAIN1.COM,DOMAIN1CLOUDCONNECTOR2.DOMAIN1.COM"}                 }        cd /                 cd "C:\Program Files (x86)\Citrix\Workspace Environment Management Agent"                 .\AgentConfigurationUtility.exe switch -c --connectors $SetWEM                 Start-service -Name NetLogon         #This registry key needs to be removed to disable the On Prem Mode so that it would successfully switch to the Cloud mode.         Remove-ItemProperty "HKLM:\SOFTWARE\Policies\Norskale\Agent Host" -Name BrokerSvcName -ErrorAction SilentlyContinue -Force         #This registry key needs to be configured separately to ensure communication with Citrix Cloud Services is established properly via proxySet-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Norskale\Agent Host" -Name ProxyAddress -type String -Value "http://<ProxyAddress>:9000"       }       catch{               "An error occurred: $_" | Out-File $CTXResealLog -append; Continue               Write-Host "An error occurred: $_  `n`r" -foregroundcolor red                 }}#Verify the DDC configuration as per the regional controllersFunction Config-DDC(){       Try       {       Write-host  "Setting Delivery Controller for the machine based on its domain" -foregroundcolor magenta switch($DomainName){            "AP" {$SetDDC = "DOMAIN3CLOUDCONNECTOR1.domain3.com DOMAIN3CLOUDCONNECTOR2.domain3.com"}            "EMA" {$SetDDC = "DOMAIN2CLOUDCONNECTOR1.domain2.com DOMAIN2CLOUDCONNECTOR2.domain2.com"}            Default{$SetDDC = "DOMAIN1CLOUDCONNECTOR1.DOMAIN1.COM DOMAIN1CLOUDCONNECTOR2.DOMAIN1.COM"}                            }             set-itemproperty "HKLM:\Software\Citrix\VirtualDesktopAgent" -Name ListOfDDCs -type String -Value $SetDDC -force       }       catch{                       "An error occurred: $_" | Out-File $CTXResealLog -append; Continue                       Write-Host "An error occurred: $_  `n`r" -foregroundcolor red                           }}Config-WEMConfig-DDC

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Running Remotely in a script Block through PSSession

    Function Config-DDC(){$VDIList=Read-Host "Type the path of VDI FQDN text file"$VDAs=Get-Content $VDIList$Date = get-date -uformat "%m%d%y"foreach($VDA in $VDAs){    $VDA = $VDA.trim()    $VDA= ([system.Net.Dns]::GetHostByName(("$VDA"))).hostname    Write-Host "$VDA" -foregroundcolor "magenta"    $VDAsession = New-PSSession -ComputerName $VDA -ErrorAction SilentlyContinue    if ($serversession.State -ne "Opened") {Write-host "$VDA - Cannot establish PS session" -foregroundcolor "red"}else {                  Invoke-Command -Session $VDAsession -ScriptBlock      {      $DomainName = (Get-WmiObject Win32_ComputerSystem).domain.Split(".")[0]      Write-host  "Setting Delivery Controller for the machine based on its domain" -foregroundcolor magenta        switch($DomainName)        {            "AP" {$SetDDC = "DOMAIN3CLOUDCONNECTOR1.domain3.com DOMAIN3CLOUDCONNECTOR2.domain3.com"}                        "EMA" {$SetDDC = "DOMAIN2CLOUDCONNECTOR1.domain2.com DOMAIN2CLOUDCONNECTOR2.domain2.com"}            Default{$SetDDC = "DOMAIN1CLOUDCONNECTOR1.DOMAIN1.COM DOMAIN1CLOUDCONNECTOR2.DOMAIN1.COM"}                                              }           set-itemproperty "HKLM:\Software\Citrix\VirtualDesktopAgent" -Name ListOfDDCs -type String -Value $SetDDC -force     }     }}}Config-DDC Function Config-WEM(){$VDIList=Read-Host "Type the path of VDI FQDN text file"$VDAs=Get-Content $VDIList$Date = get-date -uformat "%m%d%y"foreach($VDA in $VDAs){    $VDA = $VDA.trim()    $VDA= ([system.Net.Dns]::GetHostByName(("$VDA"))).hostname    Write-Host "$VDA" -foregroundcolor "magenta"    $VDAsession = New-PSSession -ComputerName $VDA -ErrorAction SilentlyContinue    if ($serversession.State -ne "Opened") {Write-host "$VDA - Cannot establish PS session" -foregroundcolor "red"}else {Write-host  "Setting WEM server for the machine based on its domain" -foregroundcolor magenta       switch($DomainName){            "Domain1" {$SetWEM = "DOMAIN3CLOUDCONNECTOR1.domain3.com,DOMAIN3CLOUDCONNECTOR2.domain3.com"}                        "Domain2" {$SetWEM = "DOMAIN2CLOUDCONNECTOR1.domain2.com,DOMAIN2CLOUDCONNECTOR2.domain2.com"}            Default{$SetWEM = "DOMAIN1CLOUDCONNECTOR1.DOMAIN1.COM,DOMAIN1CLOUDCONNECTOR2.DOMAIN1.COM"}                                              }        cd /                                              cd "C:\Program Files (x86)\Citrix\Workspace Environment Management Agent"                                              .\AgentConfigurationUtility.exe switch -c --connectors $SetWEM                                              Start-service -Name NetLogon                #This registry key needs to be removed to disable the On Prem Mode so that it would successfully switch to the Cloud mode.                Remove-ItemProperty "HKLM:\SOFTWARE\Policies\Norskale\Agent Host" -Name BrokerSvcName -ErrorAction SilentlyContinue -Force                               #This registry key needs to be configured separately to ensure communication with Citrix Cloud Services is established properly via proxy                Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Norskale\Agent Host" -Name ProxyAddress -type String -Value "http://<ProxyAddress>:9000"}}}Config-WEM

    Reference Links:

    PoC Guide: Automated Configuration Tool | Citrix Tech Zone

    Migrate configuration to Citrix Cloud

    MIgrate From on Premises to cloud

     

    Are you a member of CUGC? Join FREE today!


    User Feedback

    Recommended Comments



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...