In some cases you may see the following error when running PowerShell scripts on Active Directory:
PS C:\> Get-ADUser tycho.brahe Get-ADUser : Unable to find a default server with Active Directory Web Services running. At line:1 char:1 + Get-ADUser tycho.brahe + ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (tycho.brahe:ADUser) [Get-ADUser], ADServerDownException + FullyQualifiedErrorId : ActiveDirectoryServer:1355,Microsoft.ActiveDirectory.Management.Commands.GetADUser
The error message indicates that the Active Directory Web Services service is not running or accessible.
If you’re not running the script from a domain controller, start by checking if you have connectivity with your Active Directory domain. DNS name resolution is often the cause of connectivity issues.
If you’re currently on a domain controller, check if the Active Directory Web Service is running.
Use the following PowerShell command:
PS C:\> (Get-Service ADWS).Status Stopped
Or open up the services management console and check the status of the service:
If the service is stopped you can try to start it.
If the service doesn’t start you may need to investigate this further:
The service has many dependencies, one of them being the .Net Framework (get the .Net Framework repair tool here).
Investigate your Windows application event log for further information that will help you in troubleshooting this issue.