Hi All,
I’m relatively new to DSC and have started working on setting up a lab configuration.
I’m trying to achieve the following sequence of events…
- Push the configuration to the server, rename it to DC1
- Promote DC1 to be the first domain controller in the testing.local forest
Here is my configuration script…
$ConfigurationData = @{ AllNodes = @( @{ NodeName = '*' PSDscAllowPlainTextPassword = $True }, @{ NodeName = '192.168.1.1' HostName = 'dc1' Role = 'FirstDomainController' BackendAlias = 'Ethernet' DNSAddress = '192.168.1.1' DomainName = 'testing.local' AD_DB_Path = 'd:\ntds' AD_Log_Path = 'd:\ntds\log' AD_SysVol_Path = 'd:\ntds\SYSVOL' DSRMPassword = 'Password1' } ) } Configuration Lab_Configuration { param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [PSCredential]$DomainCredentials ) Import-DscResource -ModuleName xRemoteDesktopAdmin,xWinEventLog,xSystemSecurity,xPendingReboot,xComputerManagement,xNetworking,xActiveDirectory node $allnodes.NodeName { xIEESC DisableIEEscAdministrators { UserRole = 'Administrators' IsEnabled = $false } xIEESC DisableIEEscUsers { UserRole = 'Users' IsEnabled = $false } xUAC DisableUAC { Setting = 'NeverNotifyAndDisableAll' } xRemoteDesktopAdmin EnableRDP { Ensure = 'Present' UserAuthentication = 'Secure' } xWinEventLog SystemLog { LogName = 'System' LogMode = 'Circular' MaximumSizeInBytes = '104857600' } WindowsFeature SNMP { Name = 'SNMP-Service' Ensure = 'Present' } WindowsFeature SNMP-Tools { Name = 'RSAT-SNMP' Ensure = 'Present' } WindowsFeature PowershellISE { Name = 'Powershell-ISE' Ensure = 'Present' } WindowsFeature TelnetClient { Name = 'Telnet-Client' Ensure = 'Present' } WindowsFeature Backup { Name = 'Windows-Server-Backup' Ensure = 'Present' } switch ($Node.role) { 'WebServer' { WindowsFeature WebServer { Name = 'Web-Server' Ensure = 'Present' } } 'FirstDomainController' { xComputer SetComputerInfo { Name = $Node.HostName } WindowsFeature ActiveDirectory { Name = 'AD-Domain-Services' Ensure = 'Present' } WindowsFeature RSAT-AD-Tools { Name = 'RSAT-AD-Tools' Ensure = 'Present' } WindowsFeature RSAT-ADDS { Name = 'RSAT-ADDS' Ensure = 'Present' } WindowsFeature RSAT-AD-AdminCenter { Name = 'RSAT-AD-AdminCenter' Ensure = 'Present' } WindowsFeature RSAT-ADDS-Tools { Name = 'RSAT-ADDS-Tools' Ensure = 'Present' } xADDomain CreateForest { DomainName = $Node.DomainName DomainAdministratorCredential = $DomainCredentials SafeModeAdministratorPassword = $DomainCredentials DatabasePath = $Node.AD_DB_Path LogPath = $Node.AD_Log_Path SysvolPath = $Node.AD_SysVol_Path DependsOn = '[WindowsFeature]ActiveDirectory' } } 'AdditionalDomainController' { } } } } Lab_Configuration -ConfigurationData $ConfigurationData -DomainCredentials (Get-Credential) -output C:\DSC\config_files
When i push the configuration to the server, the windows features are added and the computer name gets changed, and DSC reboots the server which is great (LCM is configured on the server to reboot when required).
Once the server restarts, Active Directory gets added (i can see the NTDS folder on the d: as specified), however it doesn’t reboot afterwards to complete the configuration. I have tested a configuration that promotes a domain controller without first renaming the server, and at the end of the process it reboots and everything appears to work nicely.
Looking through the DSC events in the event viewer, i can see the following events …
Job {52909196-D7F1-11E4-80BA-0800279A8F85} :
This event indicates that failure happens when LCM is processing the configuration. ErrorId is 0x7. ErrorDetail is The SendConfigurationApply function did not succeed… ResourceId is [xComputer]SetComputerInfo and SourceInfo is ::134::17::xComputer. ErrorMessage is The PowerShell DSC resource C:\Program Files\WindowsPowerShell\Modules\xComputerManagement\DscResources\MSFT_xComputer returned results in a format that is not valid. The results from running Test-TargetResource must be the boolean value True or False…
[hr]
Job {52909196-D7F1-11E4-80BA-0800279A8F85} :
MIResult 1
ErrorMessage The PowerShell DSC resource C:\Program Files\WindowsPowerShell\Modules\xComputerManagement\DscResources\MSFT_xComputer returned results in a format that is not valid. The results from running Test-TargetResource must be the boolean value True or False.
MessageIDTestTargetResourceInvalidResultFormat
ErrorCategory 8
ErrorCode 7
ErrorType MI
[hr]
Job {52909196-D7F1-11E4-80BA-0800279A8F85} :
This event indicates that a non-terminating error was thrown when DSCEngine was executing Set-TargetResource on MSFT_xADDomain DSC resource. FullyQualifiedErrorId is Test.VerifyDcPromoCore.DCPromo.General.15,Microsoft.DirectoryServices.Deployment.PowerShell.Commands.InstallADDSForestCommand. ErrorMessage is Verification of prerequisites for Domain Controller promotion failed. Role change is in progress or this computer needs to be restarted.
[hr]
Job {52909196-D7F1-11E4-80BA-0800279A8F85} :
MIResult 1
ErrorMessage Verification of prerequisites for Domain Controller promotion failed. Role change is in progress or this computer needs to be restarted.
MessageIDTest.VerifyDcPromoCore.DCPromo.General.15,Microsoft.DirectoryServices.Deployment.PowerShell.Commands.InstallADDSForestCommand
ErrorCategory 0
ErrorCode 1
ErrorType MI
[hr]
I’m thinking that perhaps the errors relating to xComputer are preventing the xADDomain configuration from completing successfully. Running Get-DscConfigurationStatus -All shows the following…
Status StartDate Type Mode RebootRequested NumberOfConfigurationResources
Failure 2015/04/01 08:45:21 Reboot PUSH False 19
Success 2015/04/01 08:43:16 Initial PUSH True 19
I’m hoping that somebody can point me in the right direction as to what i am doing wrong here? Any assistance will be greatly appreciated.