/errors/active-directory/unable-to-find-a-default-server-with-active-directory-web-services-running
Unable to find a default server with Active Directory Web Services running.
- tool
- Active Directory PowerShell
- exit code
- 1
- versions
- ActiveDirectory module (RSAT) on Windows 10/11 and Windows Server 2016+
- os
- windows
Unable to find a default server with Active Directory Web Services running. means the ActiveDirectory PowerShell module (Get-ADUser, Get-ADComputer …) could not find a domain controller to talk to. The module does not use LDAP directly: it talks to Active Directory Web Services (ADWS) on a domain controller, on TCP port 9389. Without -Server, it asks the DC locator for a DC of the computer's domain. The usual causes are a computer that is not in the domain (or off the VPN), DNS that does not point at the domain's DNS servers, or a firewall blocking 9389.
Quick test: name a server
Get-ADUser -Identity jdoe -Server dc01.contoso.com
Get-ADDomain -Server contoso.com -Credential (Get-Credential) # from a machine outside the domainIf this works, the problem is locating a DC (domain membership or DNS), not ADWS itself.
Find where it breaks
nltest /dsgetdc:contoso.com # does the DC locator find a DC?
Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.contoso.com
Test-NetConnection dc01.contoso.com -Port 9389 # is ADWS reachable?
(Get-CimInstance Win32_ComputerSystem).PartOfDomain # is this machine domain-joined?On the domain controller:
Get-Service ADWS
Get-WinEvent -LogName 'Active Directory Web Services' -MaxEvents 20| Result | Meaning | Fix |
|---|---|---|
| nltest fails | no DC found through DNS | set the client DNS to the domain DNS servers, connect the VPN |
| nltest works, port 9389 closed | firewall or ADWS stopped | open TCP 9389 between client and DCs, start ADWS |
| PartOfDomain is False | workgroup or Entra-joined device | use -Server and -Credential on every cmdlet |
| Works with -Server only | default DC selection fails | set $PSDefaultParameterValues for -Server, or fix site and DNS configuration |
To avoid typing -Server on every command in a session:
$PSDefaultParameterValues['*-AD*:Server'] = 'dc01.contoso.com'Sources
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/activedirectory/
- learn.microsoft.comlearn.microsoft.com/en-us/troubleshoot/windows-server/networking/service-overview-and-network-port-requirements
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/activedirectory/get-addomaincontroller