Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xRDSessionCollection: Impossible to add a second Session Collection on Server 2019 #106

Closed
uw-dc opened this issue Sep 6, 2022 · 0 comments · Fixed by #109
Closed

xRDSessionCollection: Impossible to add a second Session Collection on Server 2019 #106

uw-dc opened this issue Sep 6, 2022 · 0 comments · Fixed by #109

Comments

@uw-dc
Copy link
Contributor

uw-dc commented Sep 6, 2022

Problem description

This relates to issue #91 which wasn't properly resolved by PR #92

In my use case, I am trying create an RDS deployment with two RD Session Collections, uxing `xRDSessionCollection.

The Test-TargetResource function in xRDSessionCollection relies on Get-TargetResource, within the same resource.

Get-TargetResource has been amended so that it filters the RD Session Collections on CollectionName matching the desired $CollectionName if there is more than one RD Session Collection returned from Get-RDSessionCollection, which had it's filtering removed (bug) when it was migrated from using WMI to CIM for Windows Server 2019.

I'm not sure why the change to xRDSessionCollection was implemented in this way, with a qualification around the filtering.

In the logs attached, there is no existing RD Session Collection called Test Collection, but because Test-TargetResource returns true, Set-TargetResource is never run.

Verbose logs

{"time": "2022-09-06T15:59:38.575+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM:  [ Start  Resource ]  [[xRDSessionCollection]collection Test Collection]  "},
  {"time": "2022-09-06T15:59:38.591+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM:  [ Start  Test     ]  [[xRDSessionCollection]collection Test Collection]  "},
  {"time": "2022-09-06T15:59:39.763+01:00", "type": "verbose", "message": "[RDS-BK1]:                            [[xRDSessionCollection]collection Test Collection] Checking for existence of RDSH collection."},
  {"time": "2022-09-06T15:59:39.778+01:00", "type": "verbose", "message": "[RDS-BK1]:                            [[xRDSessionCollection]collection Test Collection] Getting information about RDSH collection."},
  {"time": "2022-09-06T15:59:40.528+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM:  [ End    Test     ]  [[xRDSessionCollection]collection Test Collection]  in 1.9380 seconds."},
  {"time": "2022-09-06T15:59:40.528+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM:  [ Skip   Set      ]  [[xRDSessionCollection]collection Test Collection]  "},
  {"time": "2022-09-06T15:59:40.528+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM:  [ End    Resource ]  [[xRDSessionCollection]collection Test Collection]  "},

DSC configuration

@{
                        CollectionName                 = 'Main Collection'
                        SessionHost                    = @('rdsh0.somedomain.sometld,rdsh1.somedomain.sometld')
                    }
                    @{
                        CollectionName                 = 'Test Collection'
                        SessionHost                    = @('rdsh2.somedomain.sometld')
                    }

~~~

    foreach ($collection in $Collections) {
        xRDSessionCollection "collection $($collection.CollectionName)" {
            CollectionName       = $collection.CollectionName
            SessionHost          = $collection.SessionHost[0]
            ConnectionBroker     = $ConnectionBroker
            PsDscRunAsCredential = $RDSDeploymentCredential
            DependsOn            = "[xRDSessionDeployment]RdsDeployment"
        }
    }

Suggested solution

Re-implment as:

$Collection = Get-RDSessionCollection `
    -CollectionName $CollectionName `
    -ConnectionBroker $ConnectionBroker `
    -ErrorAction SilentlyContinue | `
        Where-Object  CollectionName -eq $CollectionName

or

    $params = @{
        CollectionName   = $CollectionName
        ConnectionBroker = $ConnectionBroker
        ErrorAction      = 'SilentlyContinue'
    }

    $Collection = Get-RDSessionCollection @params  | `
        Where-Object  CollectionName -eq $CollectionName

... depending on preferred layout/coding standards

Operating system the target node is running

OsName               : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.17763.2931
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.2931
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

xRemoteDesktopSessionHost version

Name                      Version Path
----                      ------- ----
xRemoteDesktopSessionHost 2.1.0   C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\2.1.0\xRemoteDesktopSessionHost.psd1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant