DSC Error is driving me nuts

Welcome Forums DSC (Desired State Configuration) DSC Error is driving me nuts

This topic contains 8 replies, has 5 voices, and was last updated by

 
Participant
4 days, 15 hours ago.

  • Author
    Posts
  • #118836

    Participant
    Points: 35
    Rank: Member

    Hi Team,

    I am trying to automate my RDS deployment and everything is working good except when it needs to configure session collection settings. This is the error that comes up all the time.

    This is the resource that is failing : xRDSessionCollectionConfiguration

    PowerShell DSC resource MSFT_xRDSessionCollectionConfiguration failed to execute Set-TargetResource functionality wi
    th 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

    The SendConfigurationApply function did not succeed.
    + CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName : RDCB01

    What this means Failed to lookup RD Session Collection RDS. There is nothing wrong with the collection. It is available, I can see it in Server Manager, but one thing I notice. When I run Get-RDSessionCollection I receive ResourceType as RemoteApp which is wrong. In servermanger it says Remote Desktop and it should be Remote Desktop because I didn't publish remote apps. I think that it something wrong with the xRDSessionCollectionConfiguration Resource. I tried 5 times on fresh installed and updated computers. Can someone please tell me how to get more info on this error. Google does not say anything and event viewer tells me exactly the same thing. So I am lost.

  • #118891

    Keymaster
    Points: 17
    Team Member
    Rank: Member

    Can you post the configuration resource with the values (or redacted ones for safety) as you have it in your configuration?

    • #118924

      Participant
      Points: 35
      Rank: Member

      Can you post the configuration resource with the values (or redacted ones for safety) as you have it in your configuration?

      Hi Will Anderson,

      I hope that you can find the reason why it is failing or point me in the right direction.

      $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
      
      
  • #118921

    Participant
    Points: 17
    Rank: Member

    .

  • #127160

    Participant
    Points: 62
    Team Member
    Rank: Member

    I realize this thread is slightly old, so maybe you have already found the solution.  But I see one thing.

    You have a section in the configuration data named RDSDATA:

    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'
    }

    However, throughout the configuration, you are addressing it as $RDData (missing the S)

    ConnectionBroker = $RDData.ConnectionBroker

    HTH

  • #128212

    Participant
    Points: 35
    Rank: Member

    Hi Melissa,

    In config data I have RDSDATA but under the first AllNodes section (connection broker) I have $RDData=data.RDSDATA

  • #128293

    Participant
    Points: 35
    Rank: Member

    Hi Melissa,

    Anything else we can do?

  • #128614

    Participant
    Points: 82
    Rank: Member

    I'm not familiar with that resource or this service, but here's what I'd try:

    • what if you comment out line 184, or remove the ErrorAction Stop: does that configure your collection? Giving you more clues?
    • If, after running your DSC Config (even if it fails where you said), the RDSessionCollection is present, does running Get-RDSessionCollection CollectionName 'RDS' works? If yes then what if you just restart the machine and run the same DSC configuration again? Something tells me that when you run the config the Get-RDSessionCollection might not work straight away. It could be a timing issue (too soon) or session issue (need a refresh)...

     

    Obviously very hard to troubleshoot without having access to your env... Good luck!

     

  • #129401

    Participant
    Points: 35
    Rank: Member

    Hi Gaelcolas,

    Thank you for the reply. I found the issue. Issue is in RDSessionCollection resource. This resource needs to be modified and updated so that works for all users and with standard deployment. In the Get-TargetResource he has "SessionHost" = $localhost and in the Test-TargetResource he is calling the get-targetresource and if we don't have $localhost this will never work. I checked his example on github and he has this variable $localhost = [System.Net.Dns]::GetHostByName((hostname)).HostName. If we don't specify this, session host server will never be discovered and you will receive that strange issue. I modified that resource and changed settings in Get-TargetResource and Set-TargetResource and now everything is working as it should. I deleted all $localhost variables and modified the code. I will go through all RDS resources and modify them if I find more issues.

    P.S. I will write about this issue on my site so that other users know what to do.

    Thank you everyone for the support.

You must be logged in to reply to this topic.