dsclibrary/modules/MyDSCResources/xJoinDomain/xJoinDomain.DSC.Schema.psm1

<###################################################################################################
DSC Template Configuration File For use by LabBuilder
.Title
    Join Domain DSC Module
.Desription
    Joins Server to Domain
.Parameters:
    DomainName = "LABBUILDER.COM"
    DomainAdminPassword = "P@ssword!1"
    ComputerName = "Server01"
    DomainControllerName = "DC01"
###################################################################################################>


Configuration JOINDOMAIN
{
        Param
    (
        # Set the Domain Name
        [Parameter(Mandatory=$True,Position=1)]
        [String]
        $DomainName,
        
        
        # Set the Domain Controller Name
        [Parameter(Mandatory=$True)]
        [String]
        $DCName,
                
        # Domain Administrator Credentials
        [Parameter(Mandatory=$True)]
        [String]
        $DomainAdminPassword,
        
        # Set the Computer Name
        [Parameter(Mandatory=$True)]
        [String]
        $ComputerName
                
        
        
    )
    
    Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
    Import-DscResource -ModuleName xComputerManagement
    Import-DscResource -ModuleName xNetworking

        # Assemble the Local Admin Credentials
        If ($LocalAdminPassword) {
            [PSCredential]$LocalAdminCredential = New-Object System.Management.Automation.PSCredential ("Administrator", (ConvertTo-SecureString $LocalAdminPassword -AsPlainText -Force))
        }
        If ($Node.DomainAdminPassword) {
            [PSCredential]$DomainAdminCredential = New-Object System.Management.Automation.PSCredential ("$DomainName\Administrator", (ConvertTo-SecureString $DomainAdminPassword -AsPlainText -Force))
        }

        WaitForAll DC
        {
        ResourceName      = '[xADDomain]CreateDC'
        NodeName          = $DCname
        RetryIntervalSec  = 15
        RetryCount        = 60
        }


        xComputer JoinDomain 
        { 
            Name          = $ComputerName
            DomainName    = $DomainName
            Credential    = $DomainAdminCredential 
            DependsOn = "[WaitForAll]DC" 
        }
    
}