dsccommunity / xRemoteDesktopSessionHost

This module contains DSC resources for the management and configuration of Microsoft Remote Desktop Session Host (RDSH).
MIT License
36 stars 47 forks source link

XRDServer: Unable to set two roles #62

Closed bendunne closed 4 years ago

bendunne commented 5 years ago

Details of the scenario you tried and the problem that is occurring

Unable to build MOF to set the RDS-Licensing Role and RDS-Gateway role on the same server,

The DSC configuration that is used to reproduce the issue (as detailed as possible)

    XRDServer LicenseServer
    {
        ConnectionBroker = $localhost
        Server = $localhost
        Role = 'RDS-Licensing'
    }

    XRDServer GatewayServer
    {
        ConnectionBroker = $localhost
        Server = $localhost
        Role = 'RDS-Gateway'
        GatewayExternalFqdn = $GatewayExternalFqdn
    }

Verbose logs showing the problem

PS C:\WINDOWS\system32> \tsc-dev-dc2\Desktop\ben.dunne\Desktop\RDSCONFIG-BUILDFILE.ps1 Test-ConflictingResources : A conflict was detected between resources '[xRDServer]LicenseServer (\tsc-dev-dc2\Desktop\ben.dunne\Desktop\RDSCONFIG-BUILDFILE.ps1::86::9::XRDServer)' and '[xRDServer]GatewayServer (\tsc-dev-dc2\Desktop\ben.dunne\Desktop\RDSCONFIG-BUILDFILE.ps1::93::9::XRDServer)' in node 'localhost'. Resources have identical key properties but there are differences in the following non-key properties: 'Role;GatewayExternalFqdn'. Values 'RDS-Licensing;NULL' don't match values 'RDS-Gateway;TSC-DEV-TS11-rdg.securevirtual.com'. Please update these property values so that they are identical in both cases. At line:289 char:9

  • Test-ConflictingResources $keywordName $canonicalizedValue $k ...
  • 
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], InvalidOperationException
    + FullyQualifiedErrorId : ConflictingDuplicateResource,Test-ConflictingResources
    Compilation errors occurred while processing configuration 'RDSConfig'. Please review the errors reported in error stream and modify your configuration code 
    appropriately.
    At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3917 char:5
  • throw $ErrorRecord
  • 
    + CategoryInfo          : InvalidOperation: (RDSConfig:String) [], InvalidOperationException
    + FullyQualifiedErrorId : FailToProcessConfiguration

Suggested solution to the issue

I suggest that these two configurations shouldn't be conflicting.

The operating system the target node is running

OsName : Microsoft Windows Server 2016 Standard OsOperatingSystemSKU : StandardServerEdition OsArchitecture : 64-bit WindowsBuildLabEx : 14393.3085.amd64fre.rs1_release.190703-1816 OsLanguage : en-GB OsMuiLanguages : {en-GB, en-US}

Version of the DSC module that was used ('dev' if using current dev branch)

Current

NReilingh commented 5 years ago

Just ran into this as well. It looks like the xRDServer resource is keyed on Server alone, so no two blocks with the same server are allowed.

I believe the fix for this is to key instead on Server and Role, so you can have as many blocks as there are unique combinations of those two properties. I am testing this out now and will submit a PR if it works.