We have a situation where out technicians, will log into an Admin Server to access the local and multiple remote locations. Let’s call it “local” and “remote” for simplicity.
I configured the main document from the main location to proxy all connections via the RTS server and I can see the active connections via the client and via the Royal Server. - success!!!
My issues are with the remote locations and the dynamic folders from the local location.
I’m using this script (see script 1 below) to create a dynamic folder with server assets of the remote and local location. I’m able to get all my servers, with their canonical name, it’s a beautiful thing - see below. The script is executed in the context of the local or remote server (foreign domain).
My issue is, how to direct the connection to connect VIA the local server or connect VIA the foreign gateway? How do I define a dependent gateway? I tried a few ways…without any success. - See Script 2
Important note. There is no name resolution between the domains. I have host files on the Royal server and the RTS client to resolve the local and foreign Royal server and gateway.
Script 1
Import-Module ActiveDirectory
[System.Collections.ArrayList]$array = @()
foreach ($computer in Get-ADComputer -SearchBase 'DC=domain,DC=local' -Filter \* -SearchScope Subtree -Properties canonicalname) {
$array.add((
New-Object -TypeName System.Management.Automation.PSObject -Property @{
"Type" = "RemoteDesktopConnection"
"Name" = $computer.name
"ComputerName" = $computer.name
"credentialName" = "dhoule"
"Path" = $computer.canonicalname.replace("/$($computer.name)", "")
}
)) | Out-Null
}
$array = $array | Sort-Object -Property path
$hash = @{}
$hash.add("Objects", $array)
$hash | ConvertTo-Json -Depth 3
Script 2
Import-Module ActiveDirectory
[System.Collections.ArrayList]$array = @()
foreach ($computer in Get-ADComputer -SearchBase 'DC=domain,DC=local' -filter {operatingsystem -like "\*server\*"} -SearchScope Subtree -Properties canonicalname, DNSHostName)
{
$array.add((
New-Object -TypeName System.Management.Automation.PSObject -Property @{
"Type" = "RemoteDesktopConnection";
"Name" = $computer.name;
"ComputerName" = $computer.DNSHostname;
"Description" = $computer.name;
"CredentialsFromParent" = "false";
"SecureGatewayFromParent"= "false";
"Path" = $computer.canonicalname.replace("/$($computer.name)","")
"RoyalServerID" = "7d6949a7-8944-4d0f-bd0c-d18aa43e93fc";
"RemoteDesktopGatewayUsage" = "Always";
"SecureGatewayName" = "7d6949a7-8944-4d0f-bd0c-d18aa43e93fc";
"SecureGatewayUsageMode" = "Always";
"RoyalServerName" = "7d6949a7-8944-4d0f-bd0c-d18aa43e93fc";
}
)) | Out-Null
}
$array = $array | Sort-Object -Property path
$hash = @{ }
$hash.add("Objects",$array)
$hash | ConvertTo-Json
I hope this is clear, it’s been a hard issue to define.
Thank you