ActiveDirectoryDsc icon indicating copy to clipboard operation
ActiveDirectoryDsc copied to clipboard

Cannot create Tree domain with ADDomain Resource

Open girvenj opened this issue 2 years ago • 1 comments

Problem description

Child domain works great, but I cannot create a tree in an existing forest with the ADDomain Resource

Verbose logs

PowerShell DSC resource MSFT_ADDomain  failed to execute Set-TargetResource functionality with error message: The 
running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: 
Verification of prerequisites for Domain Controller promotion failed. The child domain name "onpremisestree.local" has 
an invalid format. This name may contain letters, numbers, and hyphens, but not spaces or periods.
Characters that are not allowed include: ! " # $ % & ( ) * + , ' / : ; < = > ? @ [ \ ] ^ ` { | } ~
 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : LocalHost

DSC configuration

'TreeDomainController' {
  ADDomain PrimaryDC {
	  DomainName                    = $DomainDnsName
	  DomainNetBIOSName             = $DomainNetBIOSName
	  ParentDomainName              = $ParentDomainDNSName
	  Credential                    = $EaCredentials
	  SafemodeAdministratorPassword = $RestoreModeCredentials
	  DatabasePath                  = 'D:\NTDS'
	  LogPath                       = 'D:\NTDS'
	  SysvolPath                    = 'D:\SYSVOL'
	  DependsOn                     = '[User]AdministratorPassword'
  }

Suggested solution

Add "TreeDomain" as an options to install a domain into an exiting resource

https://github.com/dsccommunity/ActiveDirectoryDsc/blob/main/source/DSCResources/MSFT_ADDomain/MSFT_ADDomain.psm1#L477

Operating system the target node is running

OsName               : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.20348.643
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.643
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

ActiveDirectoryDsc version

Name               Version Path
----               ------- ----
ActiveDirectoryDsc 6.0.1   C:\Program Files\WindowsPowerShell\Modules\ActiveDirectoryDsc\6.0.1\ActiveDirectoryDsc.psd1

girvenj avatar Jun 02 '22 22:06 girvenj

This is also tracked in #689.

johlju avatar Jun 05 '22 15:06 johlju