Search code examples
powershellactive-directoryhyper-vwindows-server

can't join a server to a domain using powershell direct


i want to automate adding server to lab environment, i had problem when i tryed to join a server to a domain using power-shell direct :

Enter-PSSession -VMName S2D2 -Credential $cred
Add-Computer -DomainName "yp.org" -Credential  yp.org\administrator

give me this error :

Add-Computer : Computer 'WIN-ORGQD2DH4PU' failed to join domain 'yp.org' from its current workgroup 'WORKGROUP' with 
following error message: The specified domain either does not exist or could not be contacted.
    + CategoryInfo          : OperationStopped: (WIN-ORGQD2DH4PU:String) [Add-Computer], InvalidOperationException
    + FullyQualifiedErrorId : FailToJoinDomainFromWorkgroup,Microsoft.PowerShell.Commands.AddComputerCommand

ps: dns is working :

    ping -n 2 ADDC  

Pinging ADDC [192.168.3.10] with 32 bytes of data:
Reply from 192.168.3.10: bytes=32 time=1ms TTL=128
Reply from 192.168.3.10: bytes=32 time<1ms TTL=128

Solution

  • my problem is that i have two DNS domain in my environment i type the false ip DNS server. now it's work