I am trying to add a new connection to ASG-RD 2020 and then connect to it. I am using a remote MS SQL server to hold the database. Below are the PowerShell commands that I'm using to create the connection ending with the final command to actually cause the running instance of ASG-RD to connect to the server.
The problem is that the -connect command line fails as the running instance does not notice that the new connection has been created until it is specifically refreshed using the icon on the menu bar. The Status Message log indicates the connection isn't found. After the refresh the last command can be run again and it works as expected.
Can anyone see a way to make this work without needing to do anything within the application? -open and -find equally don't refresh anything.
Perhaps I'm missing something and there is some other way to achieve this? What are other people doing?
Code:
$vm = Get-VM 'my-server'
Connect-RDEnvironment -Environment ASGRD -PassThrough
$fldrGUID = Get-RDBaseItemId -ItemPath "Connections\Servers"
$obj = New-RDBaseItem -ParentItemId $fldrGUID -ItemType Connection -Text $vm.name
Set-RDPropertiesConnection -ItemId $obj.ItemId -Protocol RDP -IpAddress $(Get-VMGuest $vm).IPAddress[0]
& 'C:\Program Files\ASG-Remote Desktop 2020 (X64)\ASGRD.exe' -connect:$vm.name
The problem is that the -connect command line fails as the running instance does not notice that the new connection has been created until it is specifically refreshed using the icon on the menu bar. The Status Message log indicates the connection isn't found. After the refresh the last command can be run again and it works as expected.
Can anyone see a way to make this work without needing to do anything within the application? -open and -find equally don't refresh anything.
Perhaps I'm missing something and there is some other way to achieve this? What are other people doing?