locked
DSC not accepting data RRS feed

  • Question

  • Hi All,

    I am configuring DSC to install RDS but somehow the DSC not accepting value from configuration data.

    In my configuration data I have fields

    $data = @{
    
    
      AllNodes = @(
    
    
        @{
    
            NodeName                    = '*'
            PSDscAllowPlainTextPassword = $true
            PSDscAllowDomainUser        = $true
    
        },
    
        @{

    but when I run the code I get this error. Even If I have both PSDscAllowPlainTextPassword, PSDscAllowDomainUser it is not accepting it. 

    ConvertTo-MOFInstance : System.InvalidOperationException error processing property 'PsDscRunAsCredential' OF TYPE 'xRDSessionDeployment': Converting and storing encrypted passwords as plain text is not recommended. For m
    ore information on securing credentials in MOF file, please refer to MSDN blog: https://go.microsoft.com/fwlink/?LinkId=393729
    At C:\RDS2016.ps1:109 char:9
    WARNING: It is not recommended to use domain credential for node 'System.Collections.Hashtable'. In order to suppress the warning, you can add a property named 'PSDscAllowDomainUser' with a value of $true to your DSC conf
    iguration data for node 'System.Collections.Hashtable'.


    • Edited by Quantum5 Thursday, October 11, 2018 8:36 AM
    Thursday, October 11, 2018 8:35 AM

Answers

  • Node $AllNodes.Where{$_.Role -eq 'Connection Broker'} {
    $RDData = $data.RDSData
            WindowsFeature RDSConnectionBroker {
            Name = 'RDS-Connection-Broker'
            Ensure = 'Present'
            }
    

    Hi,

    Problem is in this node block. You forgot to add NodeName. 

    Node $AllNodes.Where{$_.Role -eq 'Connection Broker'}.NodeName {
    

    -----------------------------------------------------------------------------------------------------------
    If you found this post helpful, please give it a "Helpful" vote. 
    Please remember to mark the replies as answers if they help.

    • Marked as answer by Quantum5 Friday, October 12, 2018 9:21 PM
    Friday, October 12, 2018 5:59 PM

All replies

  • The error pretty much tells you the issue and the solution.  Have you read the error carefully?


    \_(ツ)_/

    Thursday, October 11, 2018 8:44 AM
  • Did you see the DSC config above and the fiels where I have both PSDscAllowPlainTextPassword, PSDscAllowDomainUser  in it. It was working in every other config but somehow it is not working now.
    Thursday, October 11, 2018 8:55 AM
  • Hi,

    Without whole code it is impossible to troubleshoot. 

    -----------------------------------------------------------------------------------------------------------
    If you found this post helpful, please give it a "Helpful" vote. 
    Please remember to mark the replies as answers if they help.

    Friday, October 12, 2018 7:41 AM
  • Hi,

    Thnx for answer. Whole configuration

    $data = @{
      AllNodes = @(
    
        @{
            NodeName = '*'
            PSDscAllowPlainTextPassword = $true
            PSDscAllowDomainUser = $true      
         },
    
        @{
            NodeName = 'rdcb1'
            Role = 'Connection Broker'
        },
    
        @{        
            NodeName = 'rdsh1'
            Role = 'Session Host'
        },
    
        @{
            NodeName = 'rdwa1'
            Role = 'Web Access'
        }
    
      );
    
      RDSData = @{
            ConnectionBroker = 'rdcb1.domain.com'
            SessionHost = 'rdsh1.domain.com'
            WebAccessServer = 'rdwa1.domain.com'
            CollectionName = 'RDS'
            AutomaticReconnectionEnabled = $true
            DisconnectedSessionLimitMin = 300
            IdleSessionLimitMin = 300
            BrokenConnectionAction = 'Disconnect'
            UserGroup = 'Domain Users'
        
       }
    
    }
    
    Configuration RDS {
    
    param ( 
        
         [Parameter(Mandatory=$true)]
         [pscredential]$DomainAdminCred
    )
    
    #region
    
    Import-DscResource -ModuleName PSDesiredStateConfiguration, 
        @{ModuleName='xRemoteDesktopSessionHost';ModuleVersion="1.8.0.0"}
    
    #endregion
    
    Node $AllNodes.Where{$_.Role -eq 'Connection Broker'} {
    $RDData = $data.RDSData
            WindowsFeature RDSConnectionBroker {
            Name = 'RDS-Connection-Broker'
            Ensure = 'Present'
            }
    
            WindowsFeature RSATRDSTools {
            Name = 'RSAT-RDS-Tools'
            Ensure = 'Present'
            IncludeAllSubFeature  = $true
            DependsOn = '[WindowsFeature]RDSConnectionBroker'
            }
            
            WaitForAll SessionHost {
            NodeName = 'rdsh1'
            ResourceName = '[WindowsFeature]SessionHost'
            RetryIntervalSec = 15
            RetryCount = 50
            DependsOn = '[WindowsFeature]RSATRDSTools'
            }
    
            WaitForAll WebAccess {
            NodeName = 'rdwa1'
            ResourceName = '[WindowsFeature]WebAccess'
            RetryIntervalSec = 15
            RetryCount = 50
            DependsOn = '[WaitForAll]SessionHost'
            }
    
            xRDSessionDeployment NewDeployment {
            ConnectionBroker = $RDData.ConnectionBroker
            SessionHost = $RDData.SessionHost
            WebAccessServer = $RDData.WebAccessServer
            DependsOn = '[WaitForAll]WebAccess'
            PsDscRunAsCredential = $DomainAdminCred
            }
    
            xRDSessionCollection collection {    
            CollectionName = $RDData.CollectionName
            SessionHost = $RDData.SessionHost
            ConnectionBroker = $RDData.ConnectionBroker
            DependsOn = '[xRDSessionDeployment]NewDeployment'
            PsDscRunAsCredential = $DomainAdminCred
            }
    } 
    
    Node $AllNodes.Where{$_.Role -eq 'Session Host'}.NodeName {
            WindowsFeature SessionHost {
            Name = 'RDS-RD-Server'
            Ensure = 'Present'
            }
    }
    
    Node $AllNodes.Where{$_.Role -eq 'Web Access'}.NodeName {
            WindowsFeature WebAccess {
            Name = 'RDS-Web-Access'
            Ensure = 'Present'
            }
        }
    }

    Friday, October 12, 2018 4:03 PM
  • Node $AllNodes.Where{$_.Role -eq 'Connection Broker'} {
    $RDData = $data.RDSData
            WindowsFeature RDSConnectionBroker {
            Name = 'RDS-Connection-Broker'
            Ensure = 'Present'
            }
    

    Hi,

    Problem is in this node block. You forgot to add NodeName. 

    Node $AllNodes.Where{$_.Role -eq 'Connection Broker'}.NodeName {
    

    -----------------------------------------------------------------------------------------------------------
    If you found this post helpful, please give it a "Helpful" vote. 
    Please remember to mark the replies as answers if they help.

    • Marked as answer by Quantum5 Friday, October 12, 2018 9:21 PM
    Friday, October 12, 2018 5:59 PM