Closed uw-dc closed 1 year ago
I was looking to start work on a fix for this, however I'm confused about the differing behavour of Set-TargetResource
when the resource is run on a server that is not the Connection Broker.
In that situation, the resource will try and add the specified Session Host to the Session Collection, irrespective of whether or not the Session Collection exists. It seems to me that Get-TargetResource
and Test-TargetResource
do the same thing, irrespective of where the module is run, and are thus inconsistent.
The very fact that the Set
is running means that the Get
and consequently the Test
has determined that the Session Collection does not exist.
I've just checked the definition of Add-RDSessionHost
and that looks to return an error if the Session Collection does not exist.
The only conclusion I can reach here, is that this logic is flawed? Should I remove the condition and instead add validation to ensure the host the resource is running on is the $ConnectionBroker
?
This is an excerpt from Add-RDSessionHost
:
$rdshCollection = Get-SessionCollectionFromName $CollectionName $ConnectionBroker
if ( $rdshCollection -eq $null )
{
Write-Error (Get-ResourceString RDSHCollectionNotFound $CollectionName)
return
}
Problem description
I'm resurrecting issue #34 here, with a proposal on how we should work around it in the suggested solution. I'm happy to raise a PR for the change.
I've experienced the same thing creating a new RDSessionCollection where certain group policy settings are applied to the session hosts in the collection.
As it stands, this problem means DSC has to be applied at least twice in order to stand up a working RDS deployment which adds to the delay.
Thanks.
Verbose logs
DSC configuration
Suggested solution
Could we add
-ErrorAction SilentlyContinue
to the call intoNew-RDSessionCollection
and then afterwards, check for the presence of the new RDSessionCollection and return success or fail based on whether or not it was created?Operating system the target node is running
PowerShell version and build the target node is running
xRemoteDesktopSessionHost version