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

xRDSessionCollection and xRDSessionCollectionConfiguration issue #56

Closed NedimMehic closed 5 years ago

NedimMehic commented 5 years ago

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.

Verbose logs showing the problem

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 "

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

$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

The operating system the target node is running

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

Version and build of PowerShell the target node is running

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

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

1.8.0.0

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

KennethVerbeure commented 5 years ago

Bump, same problem here

kbonne commented 5 years ago

The issue is in the RemoteDesktop PowerShell module itself:

PS C:\Users\admin> 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 
+ ... $scope = New-Object System.Management.ManagementScope("\\" + $Conn ... 
+              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException 
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand PS C:\Users\admin>

Changing C:\Windows\System32\WindowsPowerShell\v1.0\Modules\RemoteDesktop\SessionDesktopCollection.psm1 line 520

$scope = New-Object System.Management.ManagementScope("\\" + $ConnectionBroker + "\" + $wmiNamespace, $connectionOptions)

into

$msuri = "\\" + $ConnectionBroker + "\" + $wmiNamespace
$scope = New-Object System.Management.ManagementScope($msuri, $connectionOptions)

fixes the problem.

Not sure who to contact to fix this in the RemoteDesktop module. @PowerShellTeam ?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

stale[bot] commented 5 years ago

This issue has been automatically closed because it is has not had activity from the community in the last 40 days.

ghost commented 5 years ago

If you see this github issue and it affects you. Please vote on the upstream bug report.