How to Change Citrix Studio Default Use Port (80) to Custom Port

param ([string] $servicePrefix,

[string] $servicePath,

[string] $newPort,

[string] $newAdminAddress,

[string] $configServiceAdminAddress)

# Get a list of the old service instances. These will be replace with the new service address (including the new port)

$serviceInstanceCmd = “Get-ConfigRegisteredServiceInstance -AdminAddress {0} -InterfaceType SDK -ServiceType {1}” -f $configServiceAdminAddress, $servicePrefix

write-host $serviceInstanceCmd

$oldServiceInterfaces = Invoke-Expression $serviceInstanceCmd

# Change the port number of the services

$cmd = “&'{0}{1}’ {2} {3}” -f $xenDesktopInstallPath, $servicePath, “/SDKPort”, $newPort

write-host $cmd

Invoke-Expression “$cmd”

# Wait for the service to boot (just a precaution, the service should have started before the last command exited)

sleep 20

# Register the new service instances (these have the new address)

$serviceInstanceCmdFormatString = “Get-{0}ServiceInstance -AdminAddress {1} | Where-Object -Property InterfaceType -Value Sdk -EQ”

$serviceInstanceCmd = $serviceInstanceCmdFormatString -f $servicePrefix, $newAdminAddress

write-host $serviceInstanceCmd

$newServiceInterfaces = Invoke-Expression $serviceInstanceCmd

$oldServiceInterfaces | Unregister-ConfigRegisteredServiceInstance -AdminAddress $newAdminAddress

$newServiceInterfaces | Register-ConfigServiceInstance -AdminAddress $newAdminAddress

}


$xenDesktopInstallPath = “C:Program FilesCitrix”

$newPort = EnterNewPortNumberHere

$oldAdminAddress = “localhost”

$newAdminAddress = $oldAdminAddress + “:” + $newport

$services = @{

“Acct” = “AdIdentityServiceCitrix.ADIdentity.exe”;

“Config” = “ConfigurationServiceCitrix.Configuration.exe”

“Hyp” = “HostServiceCitrix.Host.exe”

“Applib” = “AppLibraryServiceCitrix.Applibrary.exe”;

“Analytics” = “AnalyticsServiceCitrix.Analytics.exe”;

“Broker” = “BrokerServiceBrokerService.exe”;

“Log” = “ConfigurationLoggingServiceCitrix.ConfigurationLogging.exe”;

“Admin” = “DelegatedAdminServiceCitrix.DelegatedAdmin.exe”;

“EnvTest” = “EnvTestServiceCitrix.EnvTest.exe”;

“Prov” = “MachineCreationServiceCitrix.MachineCreation.exe”;

“Monitor” = “MonitorServiceCitrix.Monitor.exe”;

“Orch” = “OrchestrationServiceCitrix.Orchestration.exe”;

“Sf” = “StorefrontServiceCitrix.Storefront.exe”;

“Trust” = “TrustServiceCitrix.Trust.exe”;

}

asnp *citrix*

ChangeSDKAddress “Config” “ConfigurationServiceCitrix.Configuration.exe” $newPort $newAdminAddress $oldAdminAddress

foreach ($serviceName in $services.Keys)

{

ChangeSDKAddress $serviceName $services[$serviceName] $newPort $newAdminAddress $newAdminAddress

}

Related:

Leave a Reply