dsccommunity / xremotedesktopsessionhost Goto Github PK
View Code? Open in Web Editor NEWThis module contains DSC resources for the management and configuration of Microsoft Remote Desktop Session Host (RDSH).
License: MIT License
This module contains DSC resources for the management and configuration of Microsoft Remote Desktop Session Host (RDSH).
License: MIT License
When I try to deploy the xRDSessionDeployment
resource on a new Windows Server 2016 machine, I am getting this error message:
"Message": "The PowerShell DSC resource \u0027[xRDSessionDeployment]Deployment\u0027 with SourceInfo \u0027::184::3::xRDSessionDeployment\u0027 threw one or more non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.",
"Data": { },
"InnerException": {
"ErrorRecord": "You cannot call a method on a null-valued expression.",
In #24 Fix Issue where DSC configuration gets into a reboot loop, line 72
(Get-TargetResource @PSBoundParameters).SessionHost -ieq $SessionHost
was changed to
# We need to perform the following check case insensitive because in some
# cases the SessionHost of Get-TargetResource is uppercase while the
# $sessionHost parameter is lowercase causing a reboot loop to happen.
(Get-TargetResource @PSBoundParameters).SessionHost.ToLower() -ieq $SessionHost.ToLower()
If New-RDSessionDeployment has not yet been run, then (Get-TargetResource @PSBoundParameters).SessionHost
is null and calling .ToLower()
results in the exception.
On a related note, -ieq
is already case-insensitive so is .ToLower()
needed here? Unit tests would help verify whether #24 is resolving the issue mentioned in the code comments.
Two servers with the xRDSessionCollection resource specified and run on them where everything is the same except for the SessionHost parameter will result in only one of them being in the Session Collection as part of the initial creation. The second Session Host will never get added.
# insert configuration here
The xRDSessionCollectionConfiguration resource should be able to configure UserProfileDisk related settings which are:
DiskPath
EnableUserProfileDisk
MaxUserProfileDiskSizeGB
IncludeFolderPath
ExcludeFolderPath
IncludeFilePath
ExcludeFilePath
Also, the resource should be able to disable the UserProfileDisk configuration if the configuration specifies so.
UserProfileDisks are a W2016+ feature only and that is probably why this resource does not support them yet. Also, on Set-RDSessionCollectionConfiguration, both enabling and disabling the User Profile Disk configuration are different parameter sets, so just adding these as parameters won't work if we don't fix the resource.
Proposed solution:
Version tested: 1.5.0.0
We should create resource specific examples for each resource, see example https://github.com/dsccommunity/FailoverClusterDsc/tree/main/source/Examples/Resources.
This requires that issue #101 is also resolved.
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 StopApplies 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
I'm not really sure this can vary wildly depending on the type of License you trying to apply.
Scenario: new deployment
[enhancement]
right now, this Get-TargetResource assumes(?) that it is being targeted by the ConnectionBroker parameter. but does not actually check if provided parameter value and targeted hostname are the same.
A simple check in the Get-TargetResource on provided ConnectionBroker value and the targetted hostname.
Details of the scenario you tried and the problem that is occurring
I am trying to configure RDS deployment across 3 servers. Everything is working until it comes to xRDSessionCollectionConfiguration. Error I receive is
Failed to lookup RD Session Collection RDS. I think that the problem starts at xRDSSessionCollection. When I run Get-RDSessionCollection I receive this error
PS C:\Windows\system32> Get-RDSessionCollection
New-Object : Exception calling ".ctor" with "1" argument(s): "Invalid parameter "
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\RemoteDesktop\SessionDesktopCollection.psm1:520 char:14
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CollectionName Size ResourceType CollectionType CollectionDescription
RDS 0 RemoteApp programs PooledUnmanaged
NOTE: I am not creating Remote App session collection. In powershell it show remote app but in server manager it show Remote Desktop.
PowerShell DSC resource MSFT_xRDSessionCollectionConfiguration failed to execute Set-TargetResource functionality with error message: Failed to lookup RD Session Collection RDS. Error: Exception calling ".ctor" with "1" argument(s): "Invalid parameter "
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : rdcb01
$data = @{
AllNodes = @(
@{
NodeName = '*'
PSDscAllowPlainTextPassword = $true
PSDscAllowDomainUser = $true
},
@{
NodeName = 'rdcb01'
Role = 'Connection Broker'
},
@{
NodeName = 'rdsh01'
Role = 'Session Host'
},
@{
NodeName = 'rdwa01'
Role = 'Web Access'
}
);
RDSData = @{
ConnectionBroker = 'rdcb01.gs.com'
SessionHost = 'rdsh01.gs.com'
WebAccessServer = 'rdwa01.gs.com'
CollectionName = 'RDS'
AutomaticReconnectionEnabled = $true
DisconnectedSessionLimitMin = 360
IdleSessionLimitMin = 360
BrokenConnectionAction = 'Disconnect'
UserGroup = 'Domain Users'
}
}
Configuration RDS {
param (
[parameter(Mandatory=$true)]
[pscredential]$DomainAdmin
)
#region DSC Resource Modules
Import-DscResource -ModuleName PSDesiredStateConfiguration,
@{ModuleName='xRemoteDesktopSessionHost';ModuleVersion="1.8.0.0"}
#endregion
Node $AllNodes.Where{$_.Role -eq 'Connection Broker'}.NodeName {
$RDData = $data.RDSData
WindowsFeature RDSConnectionBroker {
Name = 'RDS-Connection-Broker'
Ensure = 'Present'
}
WaitForAll SessionHost {
NodeName = 'rdsh01'
ResourceName = '[WindowsFeature]SessionHost'
RetryIntervalSec = 15
RetryCount = 50
DependsOn = '[WindowsFeature]RDSConnectionBroker'
}
WaitForAll WebAccess {
NodeName = 'rdwa01'
ResourceName = '[WindowsFeature]WebAccess'
RetryIntervalSec = 15
RetryCount = 50
DependsOn = '[WaitForAll]SessionHost'
}
xRDSessionDeployment NewDeployment {
ConnectionBroker = $RDData.ConnectionBroker
SessionHost = $RDData.SessionHost
WebAccessServer = $RDData.WebAccessServer
PsDscRunAsCredential = $DomainAdmin
DependsOn = '[WaitForAll]WebAccess'
}
xRDSessionCollection collection {
CollectionName = $RDData.CollectionName
SessionHost = $RDData.SessionHost
ConnectionBroker = $RDData.ConnectionBroker
PsDscRunAsCredential = $DomainAdmin
DependsOn = '[xRDSessionDeployment]NewDeployment'
}
xRDSessionCollectionConfiguration collectionconfig {
CollectionName = $RDData.CollectionName
BrokenConnectionAction = $RDData.BrokenConnectionAction
AutomaticReconnectionEnabled = $RDData.AutomaticReconnectionEnabled
ConnectionBroker = $RDData.ConnectionBroker
IdleSessionLimitMin = $RDData.IdleSessionLimitMin
DisconnectedSessionLimitMin = $RDData.DisconnectedSessionLimitMin
PsDscRunAsCredential = $ADUserCredential
DependsOn = '[xRDSessionCollection]collection'
}
}
Node $AllNodes.Where{$_.Role -eq 'Session Host'}.NodeName {
WindowsFeature SessionHost {
Name = 'RDS-RD-Server'
Ensure = 'Present'
PsDscRunAsCredential = $ADUserCredential
}
}
Node $AllNodes.Where{$_.Role -eq 'Web Access'}.NodeName {
WindowsFeature WebAccess {
Name = 'RDS-Web-Access'
Ensure = 'Present'
PsDscRunAsCredential = $ADUserCredential
}
}
}
RDS -OutputPath 'C:' -ConfigurationData $data -Verbose
OsName : Microsoft Windows Server 2019 Datacenter Evaluation
OsOperatingSystemSKU : 80
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
OBS!!!! I RECEIVE THE SAME ISSUE EVEN WHEN RUNNING SERVER 2016
Name Value
PSVersion 5.1.17763.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
1.8.0.0
Unable to build MOF to set the RDS-Licensing Role and RDS-Gateway role on the same server,
XRDServer LicenseServer { ConnectionBroker = $localhost Server = $localhost Role = 'RDS-Licensing' } XRDServer GatewayServer { ConnectionBroker = $localhost Server = $localhost Role = 'RDS-Gateway' GatewayExternalFqdn = $GatewayExternalFqdn }
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:5throw $ErrorRecord
~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (RDSConfig:String) [], InvalidOperationException
- FullyQualifiedErrorId : FailToProcessConfiguration
I suggest that these two configurations shouldn't be conflicting.
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}
Current
The resources should check is the RemoteDesktop module exists before loading it
Can these additional resources be merged into the module published in PS Gallery? Or is there a reason why they aren't?
I'm not sure if I am asking this question correctly, but I hope someone will understand.
If I run this command to install version 1.6.0.0 of xRemoteDesktopSessionHost
install-module -name xRemoteDesktopSessionHost
I am able to add these resources in my configuration file:
xRDRemoteApp
xRDSessionCollection
xRDSessionCollectionConfiguration
xRDSessionDeployment
But xRDLicenseConfiguration
is missing. How can I access xRDLicenseConfiguration
?
Checked every statement in the response, and every single point is OK.
VERBOSE: [2016Server02]: [[xRDSessionDeployment]Deployment] Verify the validation failures before adding RD Connection Broker server to the deployment.
A valid fully qualified domain name (FQDN) for the server was not specified.
Unable to connect to the server by using Windows PowerShell remoting. Verify that you can connect to the server.
The server is not joined to a domain.
The currently logged on user is not a member of the local Administrators group on the server.
The server must be running at least Windows Server 2016.
The server has reboots pending and needs to be restarted.
Remote Desktop Services connections are denied by Group Policy.
There is no resource for enabling the new Personal Session Desktops feature of Server 2016.
I plan to begin work on creating this resource within the xRemoteDesktopSessionHost module.
I plan to implement all the features in the above documentation link.
Working to map the DSC Resources in this module for Puppetization requires being able to load the cim class for each resource and introspect on its properties - this is the most accurate way to programmatically map a DSC Resource, including fully mapping nested CIM instances.
The way we do this is first, make a dummy call to Invoke-DscResource
to ensure the CIM class we want to introspect is loaded, like so:
$InvokeParams = @{
Name = 'xRDServer'
Method = 'Get'
Property = @{foo = 1}
ModuleName = @{
# Path to the module on disk
ModuleName = 'C:\dsc\...\xRemoteDesktopSessionHost\xRemoteDesktopSessionHost.psd1'
ModuleVersion = '2.0.0'
}
ErrorAction = 'Stop'
}
Try {
Invoke-DscResource @InvokeParams
} Catch {
# We only care if the resource can't be found, not if it fails while executing
if ($_.Exception.Message -match '(Resource \w+ was not found|The PowerShell DSC resource .+ does not exist at the PowerShell module path nor is it registered as a WMI DSC resource)') {
$PSCmdlet.ThrowTerminatingError($_)
}
}
# Then we can check the DSC namespace for the expected class:
Get-CimClass -ClassName 'MSFT_xRDServer' -Namespace 'root\Microsoft\Windows\DesiredStateConfiguration'
The final line above errors like so:
writeErrorStream : True
PSMessageDetails :
OriginInfo :
Exception : Microsoft.Management.Infrastructure.CimException: Not found
at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.ProcessNativeCallback(OperationCallbackProcessingContext
callbackProcessingContext, T currentItem, Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle errorDetailsHandle)
TargetObject : root\Microsoft\Windows\DesiredStateConfiguration:MSFT_xRDServer
CategoryInfo : ObjectNotFound: (root\Microsoft\...:MSFT_xRDServer:String) [Get-CimClass], CimException
FullyQualifiedErrorId : HRESULT 0x80041002,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}
And we can see if we filter the DSC namespace for classnames matching xrd
that it is indeed not loaded:
Get-CimClass -Namespace 'root\Microsoft\Windows\DesiredStateConfiguration' | ? {$_.cimclassname -match 'xrd'}
NameSpace: ROOT/Microsoft/Windows/DesiredStateConfiguration
CimClassName CimClassMethods CimClassProperties
------------ --------------- ------------------
MSFT_xRDGatewayConfiguration {} {ConfigurationName, DependsOn, ModuleName, ModuleVersion...}
MSFT_xRDLicenseConfiguration {} {ConfigurationName, DependsOn, ModuleName, ModuleVersion...}
MSFT_xRDRemoteApp {} {ConfigurationName, DependsOn, ModuleName, ModuleVersion...}
MSFT_xRDCertificateConfiguration {} {ConfigurationName, DependsOn, ModuleName, ModuleVersion...}
Notably, this worked fine for xRDCertificateConfiguration, xRDGatewayConfiguration, xRDRemoteApp, and xRDLicenseConfiguration before failing to load the CIM class for xRDServer. I reworked the catch/throw block to write the error anyway and in all cases the error message was the same - could not find RemoteDesktop module - but the other CIM classes still loaded into memory.
Not sure offhand how to hunt this one down but I wanted to at least raise it - of more than 50 modules so far converted, this is the only module we've encountered this problem with.
OsName: Microsoft Windows 10 Pro
OsOperatingSystemSKU: 48
OsArchitecture: 64-bit
WindowsVersion: 1909
WindowsBuildLabEx: 18362.1.amd64fre.19h1_release.190318-1202
OsLanguage: en-US
OsMuiLanguages: {en-US}
Name Value
---- -----
PSVersion 5.1.18362.1171
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.1171
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
2.0.0
When applying xRDSessionCollection to an RDS Host which is not also a Connection Broker the following error is being thrown:
A parameter cannot be found that matches parameter name 'CollectionDescription'. + CategoryInfo : InvalidArgument: (:) [], CimException + FullyQualifiedErrorId : NamedParameterNotFound,Add-RDSessionHost + PSComputerName : localhost
Fixed in pull this pull request: #25
if (!(Test-xRemoteDesktopSessionHostOsRequirement)) { Throw "The minimum OS requirement was not met."}
Is there any interest, for you, that when we add a sessionhost
to a collection, we can tell if the openings of sessions on this server are authorized or not?
Parameter is NewConnectionAllowed
During my deployments by hand, I often block connections to check that everything is working well on the server before opening them.
I also sometimes block connections when I am notified of a problem on a server in order to be able to diagnose
On the other hand in automatic I wonder if there is really an interest
What do you think?
I cannot specify multiple session hosts in xRDSessionDeployment without it failing. I've tried a comma separated string, semi-colon separated, and an array. The error I receive is: "A valid fully qualified domain name (FQDN) for the server was not specified."
xRDSessionCollectionConfiguration
and xRDRemoteApp
resources always failed TEST when Collection Name exceeds 15 letters.
Following Configuration will always run SET for xRDSessionCollectionConfiguration
and xRDRemoteApp
Configuration InstallRemoteDesktopSessionHost
{
Import-DscResource -ModuleName PSDesiredStateConfiguration;
Import-DscResource -ModuleName xRemoteDesktopSessionHost;
Node "localhost"
{
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
}
WindowsFeature Remote-Desktop-Services
{
Ensure = "Present"
Name = "Remote-Desktop-Services"
}
WindowsFeature RDS-RD-Server
{
Ensure = "Present"
Name = "RDS-RD-Server"
}
WindowsFeature Desktop-Experience
{
Ensure = "Absent"
Name = "Desktop-Experience"
}
WindowsFeature RSAT-RDS-Tools
{
Ensure = "Present"
Name = "RSAT-RDS-Tools"
IncludeAllSubFeature = $true
}
WindowsFeature RDS-Connection-Broker
{
Ensure = "Present"
Name = "RDS-Connection-Broker"
}
WindowsFeature RDS-Web-Access
{
Ensure = "Present"
Name = "RDS-Web-Access"
}
WindowsFeature RDS-Licensing
{
Ensure = "Present"
Name = "RDS-Licensing"
}
WindowsFeature RDS-Gateway
{
Ensure = "Present"
Name = "RDS-Gateway"
}
xRDSessionDeployment Deployment
{
SessionHost = $Node.FQDN
ConnectionBroker = $Node.FQDN
WebAccessServer = $Node.FQDN
DependsOn = "[WindowsFeature]Remote-Desktop-Services", "[WindowsFeature]RDS-RD-Server"
}
xRDSessionCollection Collection
{
CollectionName = $Node.CollectionName
CollectionDescription = $Node.CollectionDescription
SessionHost = $Node.FQDN
ConnectionBroker = $Node.FQDN
DependsOn = "[xRDSessionDeployment]Deployment"
}
xRDSessionCollectionConfiguration CollectionConfiguration
{
CollectionName = $Node.CollectionName
CollectionDescription = $Node.CollectionDescription
ConnectionBroker = $Node.FQDN
TemporaryFoldersDeletedOnExit = $false
SecurityLayer = "SSL"
DependsOn = "[xRDSessionCollection]Collection"
}
xRDRemoteApp Calc
{
CollectionName = $Node.CollectionName
DisplayName = "Calculator"
FilePath = "C:\Windows\System32\calc.exe"
Alias = "calc"
DependsOn = "[xRDSessionCollection]Collection"
}
xRDRemoteApp Mstsc
{
CollectionName = $Node.CollectionName
DisplayName = "Remote Desktop"
FilePath = "C:\Windows\System32\mstsc.exe"
Alias = "mstsc"
DependsOn = "[xRDSessionCollection]Collection"
}
}
}
$data = @{
AllNodes = @(
@{
NodeName = "*"
FQDN = [System.Net.Dns]::GetHostEntry("localhost").HostName
CollectionName = "ABCDE FGHIJ KLMNO" #17 letters
CollectionDescription = "A collection of SAMPLE Servers"
},
@{
NodeName = "localhost"
}
)
}
InstallRemoteDesktopSessionHost -ConfigurationData $data
Set-DscLocalConfigurationManager -Path .\InstallRemoteDesktopSessionHost -Force
Start-DscConfiguration -Path .\InstallRemoteDesktopSessionHost -Wait -Force -Verbose
You can avoid this issue with less than 15 character for CollectionName.
Add Length Validation to CollectionName Property would be much appreciated.
xRDSessionCollection DSC fails on Windows Server 2019 if multiple RD Session Collections are present
[[xRDSessionCollection]Collection] Getting information about RDSH
collection.
Cannot process argument transformation on parameter 'CollectionName'. Cannot convert value to type System.String.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-RDSessionHost
+ PSComputerName : localhost
Cannot index into a null array.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NullArray
+ PSComputerName : localhost
Cannot index into a null array.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NullArray
+ PSComputerName : localhost
Issue is caused by malfunctioning Get-RDSessionCollection cmdlet in Windows Server 2019.
Microsoft will need to address the underlying issue.
I'll be submitting a Pull Request with a workaround for the MSFT_xRDSessionCollection DSC Resource.
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
PSVersion 5.1.17763.1490
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1490
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
In xRemoteApp the following code is used to get the CollectionName of the current server:
This setup assumes that the configuration is applied to the ConnectionBroker and that the CollectionBroker is a sessionhost in the targetted collection. This assumption is only valid when the deployment consists of only one node, but it's not valid when multiple nodes are used with multiple collections.
Proposed fix:
Change the behaviour of xRemoteApp to test if the targetted CollectionName exists, if it does leave it untouched. If it does not exist, throw an error explaining that the RemoteApp cannot be added to a collection that does not exist.
Currently, there isn't a way to apply certificates to each role (RDGateway, RDWebAccess, RDPublishing, RDRedirector). I propose there is a resource created called xRDSessionDeploymentCertificateConfiguration to configure this. The reason I gave it this name is because the certificate assignment in the Server Manager GUI lives in the Deployment Properties.
The Set-RDCertificate CMDLET can be used to set the certificate.
Properties match closely to the Set-RDCertificate CMDLET:
my dsc-configuration fails on following error:
RD Connection Broker Configuration Failed on AWINGU-APP-1.ALLIESANDMORRISON.CO.UK With Error: The RD Connection Broker cannot be joined to the RD Management server.
When i go and look at my server it seems like everything was configuration as i wanted it.
I have a production deployment where i have an older version of this module (2014) where i install on
a windows server 2012 and there i do not have this problem.
Any idea why i would have this error? My azure arm deployments cannot continue because this configuration fails
following is my configuration:
configuration CreateAppServer
{
param
(
[Parameter(Mandatory)]
[String]$DnsServerAddress,
[Parameter(Mandatory)]
[String]$MachineName,
[Parameter(Mandatory)]
[String]$DomainName,
[Parameter(Mandatory)]
[PSCredential]$AdminCreds
)
Import-DscResource -ModuleName xComputerManagement, xRemoteDesktopSessionHost
[PSCredential]$DomainCreds = New-Object System.Management.Automation.PSCredential("${DomainName}\$($AdminCreds.UserName)", $AdminCreds.Password)
[String]$localhost = [System.Net.Dns]::GetHostByName((hostname)).HostName
[String]$collectionName = 'firstcollection'
[String]$collectionDescription = 'My first collection'
[String]$commandLineParameter = '/v:' + $DnsServerAddress
Node localhost
{
LocalConfigurationManager
{
ConfigurationMode = 'ApplyOnly'
ActionAfterReboot = 'ContinueConfiguration'
RebootNodeIfNeeded = $true
}
WindowsFeature Remote-Desktop-Services
{
Ensure = "Present"
Name = "Remote-Desktop-Services"
DependsOn = "[xComputer]JoinDomain"
}
WindowsFeature RDS-RD-Server
{
Ensure = "Present"
Name = "RDS-RD-Server"
DependsOn = "[xComputer]JoinDomain"
}
WindowsFeature RDS-Connection-Broker
{
Ensure = "Present"
Name = "RDS-Connection-Broker"
DependsOn = "[xComputer]JoinDomain"
}
WindowsFeature RDS-Licensing
{
Ensure = "Present"
Name = "RDS-Licensing"
DependsOn = "[xComputer]JoinDomain"
}
WindowsFeature RDS-Web-Access
{
Ensure = "Present"
Name = "RDS-Web-Access"
DependsOn = "[xComputer]JoinDomain"
}
xRDSessionDeployment Deployment
{
SessionHost = $localhost
ConnectionBroker = $localhost
WebAccessServer = $localhost
DependsOn = "[WindowsFeature]Remote-Desktop-Services", "[WindowsFeature]RDS-RD-Server"
}
xRDSessionCollection Collection
{
CollectionName = $collectionName
CollectionDescription = $collectionDescription
SessionHost = $localhost
ConnectionBroker = $localhost
DependsOn = "[xRDSessionDeployment]Deployment"
}
xRDSessionCollectionConfiguration CollectionConfiguration
{
CollectionName = $collectionName
CollectionDescription = $collectionDescription
ConnectionBroker = $localhost
TemporaryFoldersDeletedOnExit = $false
AuthenticateUsingNLA = $false
DisconnectedSessionLimitMin = 1
BrokenConnectionAction = "Disconnect"
DependsOn = "[xRDSessionCollection]Collection"
}
xRDRemoteApp Notepad
{
CollectionName = $collectionName
DisplayName = "Notepad"
FilePath = "C:\Windows\System32\notepad.exe"
Alias = "notepad"
CommandLineSetting = "Allow"
DependsOn = "[xRDSessionCollection]Collection"
}
xRDRemoteApp Mstsc
{
CollectionName = $collectionName
DisplayName = "Remote Desktop Connection"
FilePath = "C:\Windows\System32\mstsc.exe"
Alias = "mstsc"
CommandLineSetting = "Require"
RequiredCommandLine = $commandLineParameter
DependsOn = "[xRDSessionCollection]Collection"
}
}
}
It is in the documentation, and as was suggested in my other thread, this is almost a critical resource for use in Citrix or VMware deployments. Neither of these technologies use the MS RDS collections or configurations.
As part of this resource, an option should be specified to allow RDS connections without NLA authentication.
David F.
ISSUE DESCRIPTION
I'm using Ansible to run the xRDCertificateConfiguration resource and only when applying a certificate to the RDWebaccess role I get the following error message.
Failed to invoke DSC Set method: Failed to apply certificate from path ''C:\windows\temp\rds-cert.pfx'' to role ''RDWebAccess'' on connection broker ''hostnamel''. Error: ''The term ''Get-RDServer'' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.'''
I figured this was an issue due to the box not being ready so I added a delay of 60 seconds and 10 retires and unfortunately the result is the same.
###Output of successfully applying a certificate to other roles
TASK [ad_rds : Configure RDS Certificate] ************************************************************************************************************************************************************************************************************************changed: [10.9.10.18] => (item=RDRedirector) => changed=true
ansible_loop_var: item
attempts: 1
item: RDRedirector
module_version: 2.0.0
reboot_required: false
changed: [10.9.10.18] => (item=RDPublishing) => changed=true
ansible_loop_var: item
attempts: 1
item: RDPublishing
module_version: 2.0.0
reboot_required: false
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}
Name Value
PSVersion 5.1.17763.771
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.771
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version 2.0.0
Example:
Fixed in this pull request:
#26
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.
{"time": "2022-09-06T13:40:47.562+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM: [ Start Resource ] [[xRDSessionCollection]collection FooBar Collection] "},
{"time": "2022-09-06T13:40:47.587+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM: [ Start Test ] [[xRDSessionCollection]collection FooBar Collection] "},
{"time": "2022-09-06T13:40:48.431+01:00", "type": "verbose", "message": "[RDS-BK1]: [[xRDSessionCollection]collection FooBar Collection] Checking for existence of RDSH collection."},
{"time": "2022-09-06T13:40:48.432+01:00", "type": "verbose", "message": "[RDS-BK1]: [[xRDSessionCollection]collection FooBar Collection] Getting information about RDSH collection."},
{"time": "2022-09-06T13:40:50.326+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM: [ End Test ] [[xRDSessionCollection]collection FooBar Collection] in 2.7400 seconds."},
{"time": "2022-09-06T13:40:50.326+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM: [ Start Set ] [[xRDSessionCollection]collection FooBar Collection] "},
{"time": "2022-09-06T13:40:51.660+01:00", "type": "verbose", "message": "[RDS-BK1]: [[xRDSessionCollection]collection FooBar Collection] Creating a new RDSH collection."},
{"time": "2022-09-06T13:41:03.835+01:00", "type": "error", "message": "The property SecurityLayer is configured by using Group Policy settings. Use the Group Policy Management Console to configure this property."},
{"time": "2022-09-06T13:41:03.975+01:00", "type": "error", "message": "The property EncryptionLevel is configured by using Group Policy settings. Use the Group Policy Management Console to configure this property."},
{"time": "2022-09-06T13:44:19.341+01:00", "type": "error", "message": "The property UserAuthenticationRequired is configured by using Group Policy settings. Use the Group Policy Management Console to configure this property."},
{"time": "2022-09-06T13:44:19.521+01:00", "type": "verbose", "message": "[RDS-BK1]: LCM: [ End Set ] [[xRDSessionCollection]collection FooBar Collection] in 209.1950 seconds."},
{"time": "2022-09-06T13:44:19.526+01:00", "type": "error", "message": "The PowerShell DSC resource '[xRDSessionCollection]collection FooBar Collection' with SourceInfo 'D:\\DscService\\Build\\Modules\\tpRDSConfig\\0.1.0.130\\tpRDSConfig.psm1::391::9::xRDSessionCollection' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details."},
xRDSessionCollection "collection $($collection.CollectionName)" {
CollectionName = $collection.CollectionName
SessionHost = $collection.SessionHost[0]
ConnectionBroker = $ConnectionBroker
PsDscRunAsCredential = $RDSDeploymentCredential
DependsOn = "[xRDSessionDeployment]RdsDeployment"
}
Could we add -ErrorAction SilentlyContinue
to the call into New-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?
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}
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
Name Version Path
---- ------- ----
xRemoteDesktopSessionHost 2.1.0 C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\2.1.0\xRemoteDesktopSessionHost.psd1
We've been working with the xRemoteDesktopSessionHost DSC module that is included with azure-quickstart-templates/rds-deployment/. This module includes several other resources for configuring a RDS environment that are not included in this published version. I assume these were built by the RDS team but it would be nice if they were either combined into this module or a new DSC module created (something like xRemoteDesktopConfiguration) to include the resources that are missing from this module. Those resources are:
xRDGatewayConfiguration
xRDLicenseConfiguration
xRDServer
Let us know if there are any plans to provide/maintain these in the PowerShell Gallery.
Thanks...Greg
Hi when using this for RDS deployment on windows 2016 it enters an state of a reboot loop after i states "The deployment was successful" in an "xRDSessionDeployment". Then i hangs in that state, and never continues to the Collection or CollectionConfiguration???
Any ideas?
VERBOSE: Performing the operation "Start-DscConfiguration: SendMetaConfigurationApply" on target "MSFT_DSCLocalConfigurationManager".
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendMetaConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer 2016DSC02 with user sid S-1-5-21-662093251-837600086-2983080374-500.
VERBOSE: [2016DSC02]: LCM: [ Start Set ]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [MSFT_DSCMetaConfiguration]
VERBOSE: [2016DSC02]: LCM: [ Start Set ] [MSFT_DSCMetaConfiguration]
VERBOSE: [2016DSC02]: LCM: [ End Set ] [MSFT_DSCMetaConfiguration] in 0.0140 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [MSFT_DSCMetaConfiguration]
VERBOSE: [2016DSC02]: LCM: [ End Set ]
VERBOSE: [2016DSC02]: LCM: [ End Set ] in 0.0420 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Set-DscLocalConfigurationManager finished in 0.274 seconds.
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer 2016DSC02 with user sid S-1-5-21-662093251-837600086-2983080374-500.
VERBOSE: [2016DSC02]: LCM: [ Start Compare ]
VERBOSE: [2016DSC02]: [DSCEngine] Importing the module C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\DscResources\MSFT_RoleResource\MSFT_RoleResource.psm1 in force mode.
VERBOSE: [2016DSC02]: [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\1.4.0.0\DscResources\MSFT_xRDSessionDeployment\MSFT_xRDSessionDeployment.psm1 in force mode.
VERBOSE: [2016DSC02]: [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\1.4.0.0\DscResources\MSFT_xRDSessionCollection\MSFT_xRDSessionCollection.psm1 in force mode.
VERBOSE: [2016DSC02]: [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\1.4.0.0\DscResources\MSFT_xRDSessionCollectionConfiguration\MSFT_xRDSessionCollectionConfiguration.psm1 in force mode.
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]Remote-Desktop-Services]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]Remote-Desktop-Services]
VERBOSE: [2016DSC02]: [[WindowsFeature]Remote-Desktop-Services] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]Remote-Desktop-Services] The operation 'Get-WindowsFeature' started: Remote-Desktop-Services
VERBOSE: [2016DSC02]: [[WindowsFeature]Remote-Desktop-Services] The operation 'Get-WindowsFeature' succeeded: Remote-Desktop-Services
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]Remote-Desktop-Services] True in 0.2600 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]Remote-Desktop-Services]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RDS-RD-Server]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RDS-RD-Server]
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-RD-Server] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-RD-Server] The operation 'Get-WindowsFeature' started: RDS-RD-Server
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-RD-Server] The operation 'Get-WindowsFeature' succeeded: RDS-RD-Server
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RDS-RD-Server] True in 0.2030 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RDS-RD-Server]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RSAT-RDS-Tools]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RSAT-RDS-Tools]
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' started: RSAT-RDS-Tools
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' succeeded: RSAT-RDS-Tools
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' started: RSAT-RDS-Gateway
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' succeeded: RSAT-RDS-Gateway
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' started: RSAT-RDS-Licensing-Diagnosis-UI
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' succeeded: RSAT-RDS-Licensing-Diagnosis-UI
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' started: RDS-Licensing-UI
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' succeeded: RDS-Licensing-UI
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RSAT-RDS-Tools] True in 0.6660 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RSAT-RDS-Tools]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RDS-Connection-Broker]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RDS-Connection-Broker]
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Connection-Broker] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Connection-Broker] The operation 'Get-WindowsFeature' started: RDS-Connection-Broker
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Connection-Broker] The operation 'Get-WindowsFeature' succeeded: RDS-Connection-Broker
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RDS-Connection-Broker] True in 0.2040 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RDS-Connection-Broker]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RDS-Web-Access]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RDS-Web-Access]
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Web-Access] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Web-Access] The operation 'Get-WindowsFeature' started: RDS-Web-Access
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Web-Access] The operation 'Get-WindowsFeature' succeeded: RDS-Web-Access
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RDS-Web-Access] True in 0.2020 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RDS-Web-Access]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RDS-Licensing]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RDS-Licensing]
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Licensing] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Licensing] The operation 'Get-WindowsFeature' started: RDS-Licensing
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Licensing] The operation 'Get-WindowsFeature' succeeded: RDS-Licensing
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RDS-Licensing] True in 0.2060 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RDS-Licensing]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[xRDSessionDeployment]Deployment]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[xRDSessionDeployment]Deployment]
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Importing the module MSFT_xRDSessionDeployment in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Importing the module MSFT_xRDSessionDeployment in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Checking RDSH role is deployed on this node.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Getting list of RD Server roles.
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[xRDSessionDeployment]Deployment] False in 1.2290 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[xRDSessionDeployment]Deployment]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[xRDSessionCollection]Collection]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[xRDSessionCollection]Collection]
VERBOSE: [2016DSC02]: [[xRDSessionCollection]Collection] Importing the module MSFT_xRDSessionCollection in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionCollection]Collection] Importing the module MSFT_xRDSessionCollection in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionCollection]Collection] Checking for existance of RDSH collection.
VERBOSE: [2016DSC02]: [[xRDSessionCollection]Collection] Getting information about RDSH collection.
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[xRDSessionCollection]Collection] False in 0.7110 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[xRDSessionCollection]Collection]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[xRDSessionCollectionConfiguration]CollectionConfiguration]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[xRDSessionCollectionConfiguration]CollectionConfiguration]
VERBOSE: [2016DSC02]: [[xRDSessionCollectionConfiguration]CollectionConfiguration] Importing the module MSFT_xRDSessionCollectionConfiguration in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionCollectionConfiguration]CollectionConfiguration] Importing the module MSFT_xRDSessionCollectionConfiguration in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionCollectionConfiguration]CollectionConfiguration] Testing DSC collection properties
VERBOSE: [2016DSC02]: [[xRDSessionCollectionConfiguration]CollectionConfiguration] Getting currently configured RDSH Collection properties
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[xRDSessionCollectionConfiguration]CollectionConfiguration] False in 2.9200 seconds.
VERBOSE: [2016DSC02]: LCM: [ FAILEDCompare ] Completed processing compare operation. The operation returned False.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 7.443 seconds
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DESKTOP-DOOA2AM with user sid S-1-5-21-662093251-837600086-2983080374-500.
VERBOSE: [2016DSC02]: LCM: [ Start Set ]
VERBOSE: [2016DSC02]: [DSCEngine] Importing the module C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\DscResources\MSFT_RoleResource\MSFT_RoleResource.psm1 in force mode.
VERBOSE: [2016DSC02]: [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\1.4.0.0\DscResources\MSFT_xRDSessionDeployment\MSFT_xRDSessionDeployment.psm1 in force mode.
VERBOSE: [2016DSC02]: [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\1.4.0.0\DscResources\MSFT_xRDSessionCollection\MSFT_xRDSessionCollection.psm1 in force mode.
VERBOSE: [2016DSC02]: [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\1.4.0.0\DscResources\MSFT_xRDSessionCollectionConfiguration\MSFT_xRDSessionCollectionConfiguration.psm1 in force mode.
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]Remote-Desktop-Services]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]Remote-Desktop-Services]
VERBOSE: [2016DSC02]: [[WindowsFeature]Remote-Desktop-Services] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]Remote-Desktop-Services] The operation 'Get-WindowsFeature' started: Remote-Desktop-Services
VERBOSE: [2016DSC02]: [[WindowsFeature]Remote-Desktop-Services] The operation 'Get-WindowsFeature' succeeded: Remote-Desktop-Services
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]Remote-Desktop-Services] in 0.2080 seconds.
VERBOSE: [2016DSC02]: LCM: [ Skip Set ] [[WindowsFeature]Remote-Desktop-Services]
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]Remote-Desktop-Services]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RDS-RD-Server]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RDS-RD-Server]
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-RD-Server] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-RD-Server] The operation 'Get-WindowsFeature' started: RDS-RD-Server
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-RD-Server] The operation 'Get-WindowsFeature' succeeded: RDS-RD-Server
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RDS-RD-Server] in 0.2100 seconds.
VERBOSE: [2016DSC02]: LCM: [ Skip Set ] [[WindowsFeature]RDS-RD-Server]
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RDS-RD-Server]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RSAT-RDS-Tools]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RSAT-RDS-Tools]
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' started: RSAT-RDS-Tools
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' succeeded: RSAT-RDS-Tools
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' started: RSAT-RDS-Gateway
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' succeeded: RSAT-RDS-Gateway
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' started: RSAT-RDS-Licensing-Diagnosis-UI
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' succeeded: RSAT-RDS-Licensing-Diagnosis-UI
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' started: RDS-Licensing-UI
VERBOSE: [2016DSC02]: [[WindowsFeature]RSAT-RDS-Tools] The operation 'Get-WindowsFeature' succeeded: RDS-Licensing-UI
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RSAT-RDS-Tools] in 0.6780 seconds.
VERBOSE: [2016DSC02]: LCM: [ Skip Set ] [[WindowsFeature]RSAT-RDS-Tools]
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RSAT-RDS-Tools]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RDS-Connection-Broker]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RDS-Connection-Broker]
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Connection-Broker] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Connection-Broker] The operation 'Get-WindowsFeature' started: RDS-Connection-Broker
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Connection-Broker] The operation 'Get-WindowsFeature' succeeded: RDS-Connection-Broker
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RDS-Connection-Broker] in 0.2030 seconds.
VERBOSE: [2016DSC02]: LCM: [ Skip Set ] [[WindowsFeature]RDS-Connection-Broker]
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RDS-Connection-Broker]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RDS-Web-Access]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RDS-Web-Access]
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Web-Access] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Web-Access] The operation 'Get-WindowsFeature' started: RDS-Web-Access
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Web-Access] The operation 'Get-WindowsFeature' succeeded: RDS-Web-Access
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RDS-Web-Access] in 0.2060 seconds.
VERBOSE: [2016DSC02]: LCM: [ Skip Set ] [[WindowsFeature]RDS-Web-Access]
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RDS-Web-Access]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[WindowsFeature]RDS-Licensing]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[WindowsFeature]RDS-Licensing]
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Licensing] Importing the module MSFT_RoleResource in force mode.
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Licensing] The operation 'Get-WindowsFeature' started: RDS-Licensing
VERBOSE: [2016DSC02]: [[WindowsFeature]RDS-Licensing] The operation 'Get-WindowsFeature' succeeded: RDS-Licensing
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[WindowsFeature]RDS-Licensing] in 0.2060 seconds.
VERBOSE: [2016DSC02]: LCM: [ Skip Set ] [[WindowsFeature]RDS-Licensing]
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[WindowsFeature]RDS-Licensing]
VERBOSE: [2016DSC02]: LCM: [ Start Resource ] [[xRDSessionDeployment]Deployment]
VERBOSE: [2016DSC02]: LCM: [ Start Test ] [[xRDSessionDeployment]Deployment]
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Importing the module MSFT_xRDSessionDeployment in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Importing the module MSFT_xRDSessionDeployment in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Checking RDSH role is deployed on this node.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Getting list of RD Server roles.
VERBOSE: [2016DSC02]: LCM: [ End Test ] [[xRDSessionDeployment]Deployment] in 1.1990 seconds.
VERBOSE: [2016DSC02]: LCM: [ Start Set ] [[xRDSessionDeployment]Deployment]
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Importing the module MSFT_xRDSessionDeployment in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Importing the module MSFT_xRDSessionDeployment in force mode.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] Initiating new RDSH deployment.
VERBOSE: [2016DSC02]: [[xRDSessionDeployment]Deployment] The deployment was successful.
VERBOSE: [2016DSC02]: LCM: [ End Set ] [[xRDSessionDeployment]Deployment] in 44.9160 seconds.
VERBOSE: [2016DSC02]: LCM: [ End Resource ] [[xRDSessionDeployment]Deployment]
VERBOSE: [2016DSC02]: [] A reboot is scheduled to progress further. Configuration will be continued after the reboot.
WARNING: [2016DSC02]: [] A reboot is scheduled to progress further. Configuration will be continued after the reboot.
VERBOSE: [2016DSC02]: LCM: [ End Set ]
VERBOSE: [2016DSC02]: LCM: [ End Set ] in 48.4900 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 48.816 seconds
Supplying values for certain parameters either does not function as intended, or sometimes even throws errors. Parameters impacted:
CustomRdpProperty
ExcludeFilePath
ExcludeFolderPath
IncludeFilePath
IncludeFolderPath
Perform some normalization against the provided parameters and current values to do a proper comparison
xRDSessionCollectionConfiguration 'TestSessionCollection'
{
CollectionName = 'TestSessionCollection'
EnableUserProfileDisk = $true
DiskPath = 'C:\temp'
ExcludeFilePath = @()
ExcludeFolderPath = @('C:\temp\foo', 'C:\temp\bar')
IncludeFilePath = @()
IncludeFolderPath = @()
}
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Name Value
---- -----
PSVersion 5.1.17763.1007
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1007
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
2.0.0-preview0003
It looks like the Set-RDCertificate cmdlet has a -Thumbprint option that lets you use a existing certificate in the localmachine\my environment. However, i don't think this is supported in the DSC version yet.
It would be great if we where able to use this feature. That way we can install the certificate from a kv directly onto our local store in the vm and configure rds with it
I am using the XRemoteDesktopSessionHost resource to deploy my Remote Desktop Session Host instance, and everything seems to be working correctly.
However, the xRDRemoteApp resources are running successfully, but then Test-DscConfiguration is showing them as InDesiredState: False due to what looks like an issue with the Verbose property.
Any thoughts?
I can reproduce this on 2 machines now.
Start-DscConfiguration -Wait -Verbose -UseExisting
returns
VERBOSE: [DEV-RDS05]: LCM: [ Start Resource ] [[xRDRemoteApp]Win32Calc]
VERBOSE: [DEV-RDS05]: LCM: [ Start Test ] [[xRDRemoteApp]Win32Calc]
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Testing if RemoteApp is published.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Getting published RemoteApp program
Calculator, if one exists.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Property [ Alias ] with value win32calc does
not match
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Property [ CollectionName ] with value
Collection 1 does not match
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Property [ DisplayName ] with value
Calculator does not match
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Property [ FilePath ] with value
C:\Windows\system32\win32calc.exe does not match
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Property [ Verbose ] with value True does
not match
VERBOSE: [DEV-RDS05]: LCM: [ End Test ] [[xRDRemoteApp]Win32Calc] in 3.7260 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ Start Set ] [[xRDRemoteApp]Win32Calc]
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Making updates to RemoteApp.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Fetching FTAs and Icon contents from
endpoint: DEV-RDS05.IRMDEV.IRM.COM
VERBOSE: [DEV-RDS05]: LCM: [ End Set ] [[xRDRemoteApp]Win32Calc] in 10.1170 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ End Resource ] [[xRDRemoteApp]Win32Calc]
VERBOSE: [DEV-RDS05]: LCM: [ Start Resource ] [[xRDRemoteApp]iexplore]
VERBOSE: [DEV-RDS05]: LCM: [ Start Test ] [[xRDRemoteApp]iexplore]
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Testing if RemoteApp is published.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Getting published RemoteApp program Internet
Explorer, if one exists.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Property [ Alias ] with value iexplore does
not match
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Property [ CollectionName ] with value
Collection 1 does not match
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Property [ DisplayName ] with value Internet
Explorer does not match
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Property [ FilePath ] with value C:\Program
Files\Internet Explorer\iexplore.exe does not match
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Property [ Verbose ] with value True does not
match
VERBOSE: [DEV-RDS05]: LCM: [ End Test ] [[xRDRemoteApp]iexplore] in 4.7620 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ Start Set ] [[xRDRemoteApp]iexplore]
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Making updates to RemoteApp.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Fetching FTAs and Icon contents from
endpoint: DEV-RDS05.IRMDEV.IRM.COM
VERBOSE: [DEV-RDS05]: LCM: [ End Set ] [[xRDRemoteApp]iexplore] in 11.9650 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ End Resource ] [[xRDRemoteApp]iexplore]
Running Start-DscConfiguration -Wait -Verbose -UseExisting
a second time returns
VERBOSE: [DEV-RDS05]: LCM: [ Start Resource ] [[xRDSessionCollection]RDSessionCollection]
VERBOSE: [DEV-RDS05]: LCM: [ Start Test ] [[xRDSessionCollection]RDSessionCollection]
VERBOSE: [DEV-RDS05]: [[xRDSessionCollection]RDSessionCollection] Checking for existence of
RDSH collection.
VERBOSE: [DEV-RDS05]: [[xRDSessionCollection]RDSessionCollection] Getting information about
RDSH collection.
VERBOSE: [DEV-RDS05]: LCM: [ End Test ] [[xRDSessionCollection]RDSessionCollection] in 1.5150 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ Skip Set ] [[xRDSessionCollection]RDSessionCollection]
VERBOSE: [DEV-RDS05]: LCM: [ End Resource ] [[xRDSessionCollection]RDSessionCollection]
VERBOSE: [DEV-RDS05]: LCM: [ Start Resource ] [[xRDRemoteApp]Win32Calc]
VERBOSE: [DEV-RDS05]: LCM: [ Start Test ] [[xRDRemoteApp]Win32Calc]
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Testing if RemoteApp is published.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Getting published RemoteApp program
Calculator, if one exists.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Property [ Verbose ] with value True does
not match
VERBOSE: [DEV-RDS05]: LCM: [ End Test ] [[xRDRemoteApp]Win32Calc] in 3.8600 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ Start Set ] [[xRDRemoteApp]Win32Calc]
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]Win32Calc] Making updates to RemoteApp.
VERBOSE: [DEV-RDS05]: LCM: [ End Set ] [[xRDRemoteApp]Win32Calc] in 8.2350 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ End Resource ] [[xRDRemoteApp]Win32Calc]
VERBOSE: [DEV-RDS05]: LCM: [ Start Resource ] [[xRDRemoteApp]iexplore]
VERBOSE: [DEV-RDS05]: LCM: [ Start Test ] [[xRDRemoteApp]iexplore]
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Testing if RemoteApp is published.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Getting published RemoteApp program Internet
Explorer, if one exists.
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Property [ Verbose ] with value True does not
match
VERBOSE: [DEV-RDS05]: LCM: [ End Test ] [[xRDRemoteApp]iexplore] in 4.2250 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ Start Set ] [[xRDRemoteApp]iexplore]
VERBOSE: [DEV-RDS05]: [[xRDRemoteApp]iexplore] Making updates to RemoteApp.
VERBOSE: [DEV-RDS05]: LCM: [ End Set ] [[xRDRemoteApp]iexplore] in 7.0790 seconds.
VERBOSE: [DEV-RDS05]: LCM: [ End Resource ] [[xRDRemoteApp]iexplore]
I don't have one at this time.
xRDRemoteApp Win32Calc{
CollectionName = "Collection 1"
DisplayName = "Calculator"
FilePath = "C:\Windows\system32\win32calc.exe"
Alias = "win32calc"
DependsOn = "[xRDSessionCollection]RDSessionCollection"
}
xRDRemoteApp iexplore{
CollectionName = "Collection 1"
DisplayName = "Internet Explorer"
FilePath = "C:\Program Files\Internet Explorer\iexplore.exe"
Alias = "iexplore"
DependsOn = "[xRDSessionCollection]RDSessionCollection"
}
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Name Value
---- -----
PSVersion 5.1.17763.771
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.771
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
1.9.0.0
Configuration RDS
{
param (
[parameter(Mandatory = $true)]
[string]$MachineName = 'localhost',
[parameter(Mandatory = $true)]
[string]$fqdm,
[parameter(Mandatory = $true)]
[string]$url,
[parameter(Mandatory = $true)]
[string]$thumbPrint
)
Import-DscResource -ModuleName xRemoteDesktopSessionHost -ModuleVersion 2.0.0
Node $MachineName
{
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
ConfigurationMode = "ApplyOnly"
}
#Install the IIS Role
WindowsFeature SessionHost {
Name = 'RDS-RD-Server'
Ensure = 'Present'
}
#install web access role
windowsFeature WebAccess {
name = 'rds-web-access'
Ensure = 'present'
}
windowsFeature broker {
name = 'rds-connection-broker'
ensure = 'present'
}
windowsFeature gateway {
name = 'rds-gateway'
ensure = 'present'
}
windowsFeature RDLicensing {
Name = 'rds-licensing'
Ensure = 'Present'
}
xRDSessionDeployment NewDeployment {
ConnectionBroker = $fqdm
SessionHost = $fqdm
WebAccessServer = $fqdm
DependsOn = '[windowsFeature]WebAccess'
}
xRDSessionCollection collection {
CollectionName = 'QuickSessionCollection'
SessionHost = $fqdm
ConnectionBroker = $fqdm
DependsOn = '[xRDSessionDeployment]NewDeployment'
}
xRDSessionCollectionConfiguration collectionconfig {
CollectionName = 'QuickSessionCollection'
ConnectionBroker = $fqdm
AutomaticReconnectionEnabled = $true
BrokenConnectionAction = 'Disconnect'
UserGroup = 'Domain Users'
DependsOn = '[xRDSessionCollection]collection'
TemporaryFoldersDeletedOnExit = $true
SecurityLayer = 'Negotiate'
EncryptionLevel = 'ClientCompatible'
AuthenticateUsingNLA = $true
}
xRDLicenseConfiguration licenseconfig {
ConnectionBroker = $fqdm
LicenseServer = $fqdm
LicenseMode = 'PerUser'
DependsOn = '[xRDSessionCollectionConfiguration]collectionconfig'
}
xRDGatewayConfiguration GatewayConfig {
DependsOn = '[xRDSessionCollectionConfiguration]collectionconfig','[windowsFeature]gateway'
ConnectionBroker = $fqdm
GatewayServer = $fqdm
GatewayMode = 'Custom'
LogonMethod = 'Password'
UseCachedCredentials = $true
BypassLocal = $false
ExternalFqdn = $url
}
script CustomScript {
DependsOn = '[xRDGatewayConfiguration]GatewayConfig','[WindowsFeature]broker'
GetScript = { return @{result = 'result'} }
TestScript = { return $false }
SetScript = {
Import-Module -Name RemoteDesktop -Global
$roles=@(
'RDWebAccess'
'RDPublishing'
'RDRedirector'
'RDGateway'
)
foreach($role in $roles){
Set-RDCertificate -role $role -Thumbprint $using:thumbPrint -ConnectionBroker $using:fqdm -force
}
}
}
}
}
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?
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
Make ConnectionBroker as optional parametr.
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
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}
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
current xRemoteDesktopSessionHost 1.9.0.0
The manual documentation in the root README.md should be moved to the schema MOF files and individual resource README.md's to automatically generate documentation. There must be a README.md in each resource folder for wiki documentation to be generated, see example https://github.com/dsccommunity/FailoverClusterDsc/blob/main/source/DSCResources/DSC_Cluster/README.md.
$psversiontable
Name Value
---- -----
PSVersion 5.1.14393.2312
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2312
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
[environment]::OSVersion.Version
Major Minor Build Revision
----- ----- ----- --------
10 0 14393 0
When calling the 'xRDSessionDeployment' in a 'clean machine', it fails with:
You cannot call a method on a null-valued expression.
At line:80 char:5
+ (Get-TargetResource @PSBoundParameters).SessionHost.ToLower() -ie ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
(above info is from loading the resource as function and calling them direct)
The whole thing makes perfect sense, when calling the Get-TargetResource you'll get:
PS C:\Users\devadmin> Get-TargetResource -SessionHost "dev-rdg1.develop.local" -ConnectionBroker "dev-rdb1.develop.local" -WebAccessServer "dev-rdg1.develop.local"
Name Value
---- -----
WebAccessServer
SessionHost
ConnectionBroker
...and indeed; you cannot do a .ToLower() on an empty value...
Looking back in the releases; this code changed since v1.5.0.0 and this bug seems to be there since then.....(ouch?!)
I do not expect this to be fixed as this code already changed/improved in dev branch.. So I also checked that code. This too contains a bug:
PS C:\Users\devadmin> Test-TargetResource -SessionHost "dev-rdg1.develop.local" -ConnectionBroker "dev-rdb1.develop.local" -WebAccessServer "dev-rdg1.develop.local"
Get-Service : Cannot find any service with service name 'RDMS'.
At line:26 char:9
+ if((Get-Service -Name RDMS | Select-Object -ExpandProperty Status ...
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (RDMS:String) [Get-Service], ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand
WARNING: Failed to start RDMS service. Error: Cannot find any service with service name 'RDMS'.
False
The easy fix would be:
# Start service RDMS is needed because otherwise a reboot loop could happen due to
# the RDMS Service being on Delay-Start by default, and DSC kicks in too quickly after a reboot.
if((Get-Service -Name RDMS -ErrorAction SilentlyContinue| Select-Object -ExpandProperty Status) -ne 'Running')
{
try
{
Start-Service -Name RDMS -ErrorAction Stop
}
catch
{
Write-Warning "Failed to start RDMS service. Error: $_"
}
}
But I am unsure why simpler code of earlier versions has expanded to so elaborate one as above... probably the provide better feedback?
Kind request; as this resource item is main/core functionality of this DSC module and does not seem to work (you cannot not deploy an RDS environment with v1.5.0.0 or above); please push the next release asap..
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.
{"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] "},
@{
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"
}
}
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
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}
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
Name Version Path
---- ------- ----
xRemoteDesktopSessionHost 2.1.0 C:\Program Files\WindowsPowerShell\Modules\xRemoteDesktopSessionHost\2.1.0\xRemoteDesktopSessionHost.psd1
ISSUE DESCRIPTION:
In xRDSessionCollectionConfiguration, the parameter for IdleSessionLimitMin fails
Sending config to collection fails
Failed to invoke DSC Set method: The property IdleSessionLimit is configured by using Group Policy settings. Use the Group Policy Management Console to configure this property.
Remove option from config and documentation
(I'm using Ansible's win_dsc resource, so it's in that format)
resource_name: xRDSessionCollectionConfiguration
CollectionName: 'RDS-Cluster'
ActiveSessionLimitMin: '720'
AuthenticateUsingNLA: True
AutomaticReconnectionEnabled: True
BrokenConnectionAction: 'Disconnect'
ClientDeviceRedirectionOptions: 'None'
ClientPrinterAsDefault: False
ClientPrinterRedirected: False
CollectionDescription: "Collection of Session Hosts for RDS Cluster"
ConnectionBroker: 'rds-cb01.domain.fqdn'
DisconnectedSessionLimitMin: '180'
EncryptionLevel: '1'
IdleSessionLimitMin: '120'
MaxRedirectedMonitors: '3'
RDEasyPrintDriverEnabled: False
SecurityLayer: '2'
TemporaryFoldersDeletedOnExit: True
UserGroup: 'RDS Users'
DiskPath: '\\rds-upd01.domain.fqdn\UserProfileDisks'
EnableUserProfileDisk: True
MaxUserProfileDiskSizeGB: '10'
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Name Value
PSVersion 5.1.17763.1007
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1007
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
I don't see versions
Using xRDServer ressource to add an RDS-Web-Access server raises exceptions but works anyway.
{
"Exception": {
"Message": "The PowerShell DSC resource \u0027[xRDServer]AddWebServer02\u0027 with SourceInfo \u0027::179::9::xRDServer\u0027 threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.",
"Data": {
},
"InnerException": {
"SerializedRemoteException": "System.Management.Automation.CommandNotFoundException: The term \u0027Get-RDWorkspace\u0027 is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\n at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)\r\n at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)\r\n at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)\r\n at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)\r\n at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)\r\n at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)",
"SerializedRemoteInvocationInfo": "System.Management.Automation.InvocationInfo",
"ErrorRecord": "The term \u0027Get-RDWorkspace\u0027 is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.",
"WasThrownFromThrowStatement": false,
"Message": "The term \u0027Get-RDWorkspace\u0027 is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.",
"Data": "System.Collections.ListDictionaryInternal",
"InnerException": null,
"TargetSite": null,
"StackTrace": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233087
},
"TargetSite": null,
"StackTrace": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233079
},
"TargetObject": null,
"CategoryInfo": {
"Category": 7,
"Activity": "",
"Reason": "InvalidOperationException",
"TargetName": "",
"TargetType": ""
},
"FullyQualifiedErrorId": "NonTerminatingErrorFromProvider",
"ErrorDetails": null,
"InvocationInfo": null,
"ScriptStackTrace": null,
"PipelineIterationInfo": [
]
}
I found a workaround by adding a reboot if Add-RDServer fails. This is not a ideal solution as it could result in an infinite loop, but it does the job for me right now.
xRDSessionDeployment RDDeployment
{
ConnectionBroker = $MainConnectionBroker
WebAccessServer = $WebAccessServer1
SessionHost = $SessionHost
PsDscRunAsCredential = $AdminCreds
DependsOn = "[xDSCDomainjoin]JoinDomain"
}
Script AddWebServer02 {
GetScript = { @{} } # not used
SetScript = {
try {
Import-Module RemoteDesktop
Add-RDServer -Server $Using:WebAccessServer2 -Role 'RDS-Web-Access' -ConnectionBroker $Using:ConnectionBroker
}
catch {
# The function throws an exception but still works
}
}
TestScript = {
Import-Module RemoteDesktop
$servers = Get-RDServer -Role 'RDS-Web-Access' -ConnectionBroker $Using:MainConnectionBroker -ErrorAction SilentlyContinue
if ($servers -and $Using:WebAccessServer2 -in $servers.Server) { return $true } else { return $false }
}
PsDscRunAsCredential = $AdminCreds
DependsOn = "[xRDSessionDeployment]RDDeployment"
}
xRDSessionDeployment RDDeployment
{
ConnectionBroker = $MainConnectionBroker
WebAccessServer = $WebAccessServer1
SessionHost = $SessionHost
PsDscRunAsCredential = $AdminCreds
DependsOn = "[xDSCDomainjoin]JoinDomain"
}
xRDServer AddWebServer02
{
ConnectionBroker = $MainConnectionBroker
Role = 'RDS-Web-Access'
Server = $WebAccessServer2
PsDscRunAsCredential = $AdminCreds
DependsOn = "[xRDServer]AddGateway02"
}
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Name Value
---- -----
PSVersion 5.1.17763.1852
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1852
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
2.0.0
The property DisconnectedSessionLimit is configured by using Group Policy settings. Use the Group Policy Management Console to configure this property. The PowerShell DSC resource \u0027[xRDSessionCollection]Collection\u0027 with SourceInfo \u0027C:\Packages\Plugins\Microsoft.Powershell.DSC\2.75.0.0\DSCWork\CreateAppServer.ps1.0\CreateAppServer.ps1::79::9::xRDSessionCollection\u0027 threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details. The SendConfigurationApply function did not succeed. LCM failed to start desired state configuration manually.",
The UserGroups
parameter only accepts a single string, when it should support supplying an array of values.
Allow for supplying an array of values to the UserGroups
parameter.
# insert configuration here
Is this resource actually missing from the module? It is in the readme, but when I check it is not there?
PS C:\> Get-DscResource -Module xremotedesktopsessionhost
ImplementedAs Name ModuleName Version Properties
------------- ---- ---------- ------- ----------
PowerShell xRDRemoteApp xRemoteDesktopSessionHost 1.6.0.0 {Alias, CollectionName, DisplayN...
PowerShell xRDSessionCollection xRemoteDesktopSessionHost 1.6.0.0 {CollectionName, SessionHost, Co...
PowerShell xRDSessionCollectionCo... xRemoteDesktopSessionHost 1.6.0.0 {CollectionName, ActiveSessionLi...
PowerShell xRDSessionDeployment xRemoteDesktopSessionHost 1.6.0.0 {ConnectionBroker, SessionHost, ...
I'm looking to use this to configure my hosts that won't be part of an RDS Deployment..
Thanks,
David F.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.