Table of Contents
Introduction
Sometimes you might want to know, for troubleshooting reasons, what AD Site your machine belongs to.
In this blog post, I cover using nltest dsgetsite to find out which Active Directory site a computer belongs to using nltest.
What is nltest?
Nltest, or Network Location Test, is a command-line tool used in Windows Server and Windows 10.
Some examples of when you can use the tool:
- Find which site your machine belongs to
- Retrieve a list of domain controllers
- Force a shutdown remotely
- Verify the trust relationship
For a full list of parameters for nltest, refer to Microsoft Docs.
How to run the nltest dsgetsite command
Run the following command:
nltest /dsgetsite

You can see that my machine is a member of the Default-First-Site-Name Active Directory site in the below example.
I hope this small tip has helped you. Do you have any other simple ways of finding out the AD site for a workstation or server? Please leave a comment below 🙂
References
Related posts
- Powershell current directory command to browse Windows Explorer
- Domain join permissions required for users in Active Directory
- Use Powershell to add users to groups using a CSV file
Thanks! This was helpful to me today!
Hi Marc,
Great, glad that it helped you!
/Daniel
A client of mine has over 100 Domain Controllers in 27 Domains across the globe. Is there a way to pull the Site data from a DC that’s not in the Domain I run this query from? I can’t use Get-ADDomainController since that only pulls from the Domain I’m logged in to, and I don’t want to log into each Domain to get this data.