Cannot find Set-RDPublishedName.ps1 anymore. Is there a reason? Is there a new repo? Is there a new solution for what the script solved?
Thanks,
ujan
Cannot find Set-RDPublishedName.ps1 anymore. Is there a reason? Is there a new repo? Is there a new solution for what the script solved?
Thanks,
ujan
Hello @ujan-4417 ,
Please check the following script:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,HelpMessage="Specifies the FQDN that clients will use when connecting to the deployment.",Position=1)]
[string]$ClientAccessName,
[Parameter(Mandatory=$False,HelpMessage="Specifies the RD Connection Broker server for the deployment.",Position=2)]
[string]$ConnectionBroker="localhost"
)
$CurrentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
If (($CurrentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) -eq $false)
{
$ArgumentList = "-noprofile -noexit -file "{0}" -ClientAccessName $ClientAccessName -ConnectionBroker $ConnectionBroker"
Start-Process powershell.exe -Verb RunAs -ArgumentList ($ArgumentList -f ($MyInvocation.MyCommand.Definition))
Exit
}
Function Get-RDMSDeployStringProperty ([string]$PropertyName, [string]$BrokerName)
{
$ret = iwmi -Class "Win32_RDMSDeploymentSettings" -Namespace "root\CIMV2\rdms" -Name "GetStringProperty" -ArgumentList @($PropertyName) -ComputerName $BrokerName
-Authentication PacketPrivacy -ErrorAction Stop
Return $ret.Value
}
Try
{
If ((Get-RDMSDeployStringProperty "DatabaseConnectionString" $ConnectionBroker) -eq $null) {$BrokerInHAMode = $False} Else {$BrokerInHAMode = $True}
}
Catch [System.Management.ManagementException]
{
If ($Error[0].Exception.ErrorCode -eq "InvalidNamespace")
{
If ($ConnectionBroker -eq "localhost")
{
Write-Host "`n Set-RDPublishedName Failed.`n`n The local machine does not appear to be a Connection Broker. Please specify the`n FQDN of the RD Connection Broker using the -ConnectionBroker parameter.`n" -ForegroundColor Red
}
Else
{
Write-Host "`n Set-RDPublishedName Failed.`n`n $ConnectionBroker does not appear to be a Connection Broker. Please make sure you have n specified the correct FQDN for your RD Connection Broker server.n" -ForegroundColor Red
}
}
Else
{
$Error[0]
}
Exit
}
$OldClientAccessName = Get-RDMSDeployStringProperty "DeploymentRedirectorServer" $ConnectionBroker
If ($BrokerInHAMode.Value)
{
Import-Module RemoteDesktop
Set-RDClientAccessName -ConnectionBroker $ConnectionBroker -ClientAccessName $ClientAccessName
}
Else
{
$return = iwmi -Class "Win32_RDMSDeploymentSettings" -Namespace "root\CIMV2\rdms" -Name "SetStringProperty" -ArgumentList @("DeploymentRedirectorServer",$ClientAccessName) -ComputerName $ConnectionBroker
-Authentication PacketPrivacy -ErrorAction Stop
$wksp = (gwmi -Class "Win32_Workspace" -Namespace "root\CIMV2\TerminalServices" -ComputerName $ConnectionBroker)
$wksp.ID = $ClientAccessName
$wksp.Put()|Out-Null
}
$CurrentClientAccessName = Get-RDMSDeployStringProperty "DeploymentRedirectorServer" $ConnectionBroker
If ($CurrentClientAccessName -eq $ClientAccessName)
{
Write-Host "`n Set-RDPublishedName Succeeded." -ForegroundColor Green
Write-Host "`n Old name: $OldClientAccessName`n`n New name: $CurrentClientAccessName"
Write-Host "`n If you are currently logged on to RD Web Access, please refresh the page for the change to take effect.`n"
}
Else
{
Write-Host "`n Set-RDPublishedName Failed.`n" -ForegroundColor Red
}
Please "Accept as Answer" if it helped, which might be beneficial to other community members reading this thread. Thanks for your cooperation!
Hello @ujan-4417 ,
Thanks for your query.
Can you download the Set-RDPublishedName.ps1 script under the following link?
https://github.com/dwj7738/My-Powershell-Repository/blob/master/Scripts/Set-RDPublishedName.ps1
Best regards,
Leila
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hi Leila,
that guy is not the creator of the original script and his code is from 2015. Cannot trust that source. Were you able to verify?
Thanks
Jan
Hello @ujan-4417 ,
Thanks for your response.
The original powershell script has been removed after Forum migration which was written by TP:
https://social.technet.microsoft.com/Forums/en-US/92d1ddb6-f11a-4be0-b866-1792b606aa2b/setrdpublishednameps1-does-not-change-url?forum=winserverTS
We've downloaded this script before and you may modify based on your own requirements:
[Set-RDPublishedName.ps1]
https://microsoft-my.sharepoint.com/personal/v-jiyo_microsoft_com/_layouts/15/download.aspx?SourceUrl=%2Fpersonal%2Fv%2Djiyo%5Fmicrosoft%5Fcom%2FDocuments%2FMicrosoft%20Teams%20Chat%20Files%2FSet%2DRDPublishedName%2Eps1
Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics. Thanks for your cooperation
Hi Leila,
thanks for your efforts, that is fantastic. Could you share the file as public I was not able to download.
Jan
5 people are following this question.