Active Directory Response Time

Measure the response time for a user lookup on each DC within a domain.

— Binary Adventures

If you ever wondered how long it takes each domain controller in your domain to perform a user lookup, here’s a relatively small and simple script that does just that.

Given a domain name (e.g. and user account (e.g. wile.e.coyote), the script will retrieve all domain controllers within that domain, and use Get-ADUser to retrieve the user object. The time it takes to perform the lookup is captured (using Measure-Command, with millisecond precision) as well as whether or not the action was successful.

Results are stored in an array of PSCustomObject, each containing the DC hostname, a boolean indicating success or failure, and a TimeSpan object with the elapsed time. If you pass the results on to the Format-Results function, the data will be send to stdout, indicating success or failure by colouring the duration green or red.