Skip to content

How to Join Windows Server to an Active Directory Domain with PowerShell Print

  • 0

How to Join Windows Server to an Active Directory Domain with PowerShell

Applies to: Windows Server 2019, 2022 and 2025.

Domain membership centralizes identity and policy. The server must use Active Directory DNS and have accurate time before joining.

Work from console access or a tested recovery path. Changes to remote access, licensing or domain membership can lock out administrators if prerequisites are wrong. Managed Windows VPS options are available at networkmanager.info.

Prerequisites

  • Configure approved AD DNS resolvers.
  • Verify connectivity and time synchronization.
  • Authorize or pre-stage the computer account.
  • Retain local Administrator credentials for recovery.

Step-by-step procedure

Step 1: Validate DNS

Resolve the domain and LDAP service records.

Resolve-DnsName corp.example
Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.corp.example

Step 2: Check identity and time

Confirm hostname and synchronization before authentication.

hostname
w32tm /query /status

Step 3: Join and restart

Prompt for authorized credentials instead of embedding a password.

$cred = Get-Credential 'CORP\JoinAccount'
Add-Computer -DomainName 'corp.example' -Credential $cred -Restart

Step 4: Verify secure channel

After restart, confirm membership and trust.

Get-CimInstance Win32_ComputerSystem | Select Name,Domain,PartOfDomain
Test-ComputerSecureChannel -Verbose

Verification

PartOfDomain must be True and the secure-channel test should succeed.

whoami
Test-ComputerSecureChannel

Rollback

Use Remove-Computer with authorized credentials, restart and restore the approved workgroup. Confirm local access first.

Version and operational notes

This member-server procedure must not be used as a generic method for domain controllers.

Official references

For managed deployment and support, visit https://networkmanager.info/.


Was this answer helpful?

« Back