DSCResources/AddsDomainController/AddsDomainController.schema.psm1

configuration AddsDomainController
{
    param
    (
        [Parameter(Mandatory = $true)]
        [string]
        $DomainName,

        [Parameter(Mandatory = $true)]
        [pscredential]
        $Credential,

        [Parameter(Mandatory = $true)]
        [pscredential]
        $SafeModeAdministratorPassword,

        [Parameter()]
        [string]
        $DatabasePath = 'C:\Windows\NTDS',

        [Parameter()]
        [string]
        $LogPath = 'C:\Windows\Logs',

        [Parameter()]
        [string]
        $SysvolPath = 'C:\Windows\SYSVOL',

        [Parameter()]
        [string]
        $SiteName,

        [Parameter()]
        [bool]
        $IsGlobalCatalog = $true,

        [Parameter()]
        [bool]
        $IsReadOnlyReplica = $false,

        [Parameter()]
        [string]
        $InstallationMediaPath
    )

    Import-DscResource -ModuleName PSDesiredStateConfiguration
    Import-DscResource -ModuleName ActiveDirectoryDsc

    WindowsFeature ADDS {
        Name   = 'AD-Domain-Services'
        Ensure = 'Present'
    }

    WindowsFeature RSATADPowerShell {
        Name      = 'RSAT-AD-PowerShell'
        Ensure    = 'Present'
        DependsOn = '[WindowsFeature]ADDS'
    }

    WaitForADDomain 'WaitForestAvailability' {
        DomainName = $DomainName
        Credential = $Credential
        DependsOn  = '[WindowsFeature]RSATADPowerShell'
    }

    ADDomainController 'DomainControllerAllProperties' {
        DomainName                    = $DomainName
        Credential                    = $Credential
        SafeModeAdministratorPassword = $SafeModeAdministratorPassword
        DatabasePath                  = $DatabasePath
        LogPath                       = $LogPath
        SysvolPath                    = $SysvolPath
        SiteName                      = $SiteName
        ReadOnlyReplica               = $IsReadOnlyReplica
        IsGlobalCatalog               = $IsGlobalCatalog
        DependsOn                     = '[WaitForADDomain]WaitForestAvailability'
    }
}