Active Directory - Join Server to domain using PowerShell


  • Make sure preferred DNS server for all servers in the domain, including Domain Controller (DC) itself, is set to IP of domain controller. Use the following PowerShell command to set the preferred DNS server. Run it on all servers part of the domain including the DC.
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses <IP of your DC>, <alternate DNS server>

Joining server to domain

  • Give your server a meaningful name e.g. “WLG-SP13WFE”
  • Run PowerShell command on the server being joined to the domain
Add-Computer -DomainName -OUPath "ou=SharePoint, ou=Servers, ou=Machines,dc=corp,dc=contoso,dc=com"


  • Run “ipconfig /all” command and confirm that DNS server IP is set to your DC IP
  • Check the error log on DC to find out if there are any domain join failure errors logged
  • Use fully qualified domain name (FQDN) i.e. “” rather than just “Contoso”
  • Try pinging your DC from computer being joined to domain. If Ping request couldn’t locate the host then run “dcdiag /test:DNS /v /e” to get a detailed report about your domain environment
  • Run the following commands to refresh the DNS settings of the server
    • ipconfig /flushdns
    • ipconfig /registerdns
  • If using VMWare Workstation, make sure Virtual Machines are on same switch “VMnet1” for host-only or “VMnet8” for NAT
  • And finally, switch off windows Firewall and try to join the server to domain again



Popular posts from this blog

SharePoint 2013 Search Service Activation Error

VMWare Workstation - Assign a static IP address

SharePoint 2007 - Content Audit: Print last modified & ownership of all sites