Join A Domain
Joining a Windows Machine to a Domain
Author: bobbuilder
Prerequisites
- A user account with permissions to join computers to the domain.
- The domain name (e.g.,
targetdomain.com
). - The domain controller's IP or hostname (optional, but useful for troubleshooting).
- The machine must be able to reach the domain controller (DNS and network connectivity).
- The machine must have the correct DNS settings pointing to the domain controller.
Join via GUI
- Open Settings (
Win + I
). - Go to Accounts → Access work or school.
- Click Connect → Join this device to a local Active Directory domain.
- Enter the domain name (e.g.,
targetdomain.com
) and click Next. - Provide domain credentials (e.g.,
DOMAIN\username
orusername@domain.com
). - Click OK and restart the computer when prompted.
Join via System Properties
- Open Run (
Win + R
), typesysdm.cpl
, and press Enter. - Go to the Computer Name tab and click Change.
- Under Member of, select Domain and enter the domain name (e.g.,
targetdomain.com
). - Click OK and enter domain credentials when prompted.
- Restart the computer to complete the domain join.
Join via PowerShell
Check Current Domain Status
Get-ComputerInfo | Select-Object CsDomain
Get-WmiObject Win32_ComputerSystem | Select-Object Domain
Verify DNS Settings
Ensure the domain name resolves to the correct Domain Controller (DC).
Get Domain's IP Address
nslookup targetdomain.com
Get-DnsClientServerAddress
Set the DNS Server to the Domain Controller
If DNS is not set correctly, update it.
Set on a Specific Interface
Find the correct interface:
Get-NetAdapter | Select-Object ifIndex, Name, InterfaceDescription, Status
Example Output:
ifIndex Name InterfaceDescription Status
------- ---- -------------------- ------
13 OpenVPN Wintun Wintun Userspace Tunnel Disconnected
8 OpenVPN TAP-Windows6 TAP-Windows Adapter V9 Disconnected
7 Ethernet Intel(R) PRO/1000 MT Desktop Adapter Up
6 OpenVPN Data Channel Offload OpenVPN Data Channel Offload Up
Set the DNS server for the correct interface:
Set-DnsClientServerAddress -InterfaceIndex <ifIndex> -ServerAddresses ("<dc_ip>")
Or set it for a given Interface Name:
$interfID = (Get-NetAdapter | Where-Object { $_.InterfaceDescription -like "*<interface_name>*" } | Select-Object -ExpandProperty ifIndex)
Set-DnsClientServerAddress -InterfaceIndex $interfID -ServerAddresses ("<dc_ip>")
Set for All Interfaces
Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter | Select-Object -ExpandProperty ifIndex) -ServerAddresses ("<dc_ip>")
Reset DNS Settings (Undo Changes)
Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter | Select-Object -ExpandProperty ifIndex) -ResetServerAddresses
(Not Recommended) Modify Hosts File
notepad C:\Windows\System32\drivers\etc\hosts
Join the Machine to a Domain
Add-Computer -DomainName "targetdomain.com" -Credential "targetdomain\admin" -Restart
Verifying Domain Membership
After restarting, verify the domain join status.
PowerShell
Get-WmiObject Win32_ComputerSystem | Select-Object Domain
Command Prompt
echo %userdomain%
Remove Computer From Domain
GUI
PowerShell
Remove-Computer -UnjoinDomainCredential DOMAIN\Administrator -WorkgroupName WORKGROUP -Force -Restart