dsccommunity / xRemoteDesktopSessionHost

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

xRDLicenseConfiguration: No way to licence RDS #64

Open bendunne opened 4 years ago

bendunne commented 4 years ago

Description

This DSC resource doesn't contain a method to license RDS, which is a key bit missing from this collection of DSC resources as well as the Certificate assignment mentioned in #63.

Looking into a method to do this for my own environment in PowerShell, I used a mixture for the RDS:LicenseServer location and using the WMI/CIM class Win32_TSLicenseKeyPack to apply the license and activate.

Here is an example of activating using the method InstallAgreementLicenseKeyPack for this particular type of license.

Set-Location RDS:LicenseServer -ErrorAction Stop

Set-Item .\Configuration\FirstName -Value "Test" -ErrorAction Stop Set-Item .\Configuration\LastName -Value "Test" -ErrorAction Stop Set-Item .\Configuration\Company -Value "Test" -ErrorAction Stop Set-Item .\Configuration\CountryRegion -Value "Test" -ErrorAction Stop Set-Item .\ActivationStatus -Value 1 -ConnectionMethod AUTO -Reason 5 -ErrorAction Stop

Applies License

$Argumentlist =@( 4, # AgreementType 9999, # LicenseCount 1, # ProductType 5, # ProductVersion $agreementnumber # AgreementNumber )

$InstallLicenseKey = Invoke-WmiMethod -Namespace "root/cimv2" -Class Win32_TSLicenseKeyPack -Name InstallAgreementLicenseKeyPack -ArgumentList $Argumentlist

Adds the license server to the Terminal Server License Servers group on the domain controller (Run as Enterprise Admin)

Set-Item -Path RDS:\LicenseServer\LSinTSLSGroup -Value 1 -ErrorAction Stop

Proposed properties

I'm not really sure this can vary wildly depending on the type of License you trying to apply.

Special considerations or limitations

danielboth commented 4 years ago

Creating a proper resource for this is a tough one, as there are quite a bit of different options and I don't have access to all the different licenses to test them. Still, if anyone is open to create an initial version that just covers one of the licensing methods, I'm open to get that merged.

NemoDima commented 4 years ago

@danielboth can I provide an example of using RDS licensing using Enterprise agreement? Does it help you to add/create proper functionality for this case? Best wishes.