ComputerManagementDsc icon indicating copy to clipboard operation
ComputerManagementDsc copied to clipboard

xComputer cannot join domain

Open ramon-garcia opened this issue 7 years ago • 3 comments

Under Windows 2016 server, domain join fails with a mysterious message of password not strong enough. Difficult to understand, since the password of a machine account is automatically generated.

The powershell command Add-Computer (echoed in the module with Write-Verbose and then ran by hand) works prefectly if ran under the Administrator account, but it appears to fail under the LocalSystem account used by DSC.

I have read similar reports elsewhere https://social.technet.microsoft.com/Forums/windowsserver/en-US/cb6f2595-c37e-41e2-952d-9d9ae7ea8865/running-powerhshell-addcomputer-as-localsystem-fails?forum=winserverGP but none of the suggestions made have worked so far.

ramon-garcia avatar Jan 27 '18 17:01 ramon-garcia

Hi @ramon-garcia - are you able to paste a copy of the DSC config you're using in here (with sensitive info masked)?

PlagueHO avatar Jan 27 '18 18:01 PlagueHO

Names are fictional

$credential is entered interactively with $credential = Get-Credential during policy generation.

xComputer initial { Name = 'myhostname' DomainName = 'mydomain.mycompany' Credential = $credential WorkGroupName = $null JoinOU = 'OU=subpol2,OU=subpol1,OU=SomeServerType,OU=MyServers,DC=mydomain,DC=mycompany' }

ramon-garcia avatar Jan 27 '18 22:01 ramon-garcia

Hi @ramon-garcia - are you able to try using the PsDscRunAsCredential parameter to the resource to have it applied under the context of the Domain Admin to see if that resolves the issue? See this page for more info: https://docs.microsoft.com/en-us/powershell/dsc/runasuser

PlagueHO avatar Mar 06 '18 19:03 PlagueHO