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

xRDLicenseConfiguration: ConnectionBroker required. #76

Open NemoDima opened 4 years ago

NemoDima commented 4 years ago

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

For my purposes, I need to set a few settings in gpedit.msc Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Licensing:

  1. a) Use the specified Remote Desktop license servers parameter switch to Enabled. b) License servers to use , set localhostname or its own IP-address.

  2. a) Set the Remote licensing mode parameter switch to Enabled. b) Specify the licensing mode for the RD Session Host server field set to Per Device.

I planed to use xRDLicenseConfiguration to set these settings but it requires installed RDS-Connection-Broker component and set ConnectionBroker.

But all this result I can get manually only with installed RDS-Licensing, RDS-RD-Server and using gpedit.msc .

Tell me please, how I can get same result using xRDLicenseConfiguration only?

Verbose logs showing the problem

At line:28 char:9
+         xRDLicenseConfiguration SetRDPLicensingSettings
+         ~~~~~~~~~~~~~~~~~~~~~~~
Resource 'xRDLicenseConfiguration' requires that a value of type 'String' be provided for property 'ConnectionBroker'.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingValueForMandatoryProperty

Suggested solution to the issue

Make ConnectionBroker as optional parametr.

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

Configuration Basic_settings
{
    Import-DSCResource -ModuleName ComputerManagementDsc #For Powerplan, PagingSettings, SetTimeZone
    Import-DSCResource -ModuleName PSDesiredStateConfiguration
    Import-DSCResource -ModuleName xRemoteDesktopSessionHost #For RDP

    Node "localhost"
    {

        $servername = 'testserver'
        $workgroupname = 'company'

        Computer SetNameandWorkgroup
        {
            Name          = $servername
            WorkGroupName = $workgroupname
        }

        #---------------- RDP ------------------

        WindowsFeatureSet InstallRDS
        {
            # Install Desktop Licensing and Remote Desktop Session Host from Remote Desktop Services
            Name = @('RDS-Connection-Broker', 'RDS-Licensing', 'RDS-RD-Server')
            Ensure = 'Present'            
        }

        xRDLicenseConfiguration SetRDPLicensingSettings
        {
            #ConnectionBroker = $servername
            LicenseMode = 'PerDevice'
            DependsOn = '[WindowsFeatureSet]InstallRDS'
            LicenseServer = $servername
            PsDscRunAsCredential = $credential
        }
    }
}

$configData = @{
    AllNodes = @(
        @{
            NodeName = '*'
            PSDscAllowPlainTextPassword = $True
            PsDscAllowDomainUser = $true   
        }
        @{
            NodeName = 'localhost'
            PSDscAllowPlainTextPassword = $True
            PsDscAllowDomainUser = $true   
        }
    )
}

Basic_settings -OutputPath "C:\DSC\Configurations" -ConfigurationData $configData

The operating system the target node is running

OsName               : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 14393.1794.amd64fre.rs1_release.171008-1615
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

PSVersion                      5.1.14393.1884                                                                                        
PSEdition                      Desktop                                                                                               
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                               
BuildVersion                   10.0.14393.1884                                                                                       
CLRVersion                     4.0.30319.42000                                                                                       
WSManStackVersion              3.0                                                                                                   
PSRemotingProtocolVersion      2.3                                                                                                   
SerializationVersion           1.1.0.1

Version of the DSC module that was used

current xRemoteDesktopSessionHost 1.9.0.0

изображение

изображение