Useful Commands to Query in Active Directory
Active Directory is a directory service created by Microsoft. It stores all information and settings in a database.
There are many things you can do using the graphical user interface to query in Active Directory. But if you like the elegance of a script or the pure speed of a command line, these commands are the way to go.
If you don’t think you need to use the command line since you’re in Windows, think about. System Administrators should get into the habit of using the command line as a quick and fast way to look up information or write a script.
Q1. How to find all GCs in a forest?
dsquery server -forest -isgc
Q2. How to find the owner of an individual FSMO role?
dsquery server -hasfsmo <Role>
where <Role> can be schema, name, infr, pdc, or rid
Q3. How to list all subnets?
Q4. How to list all DCs in a domain?
dsquery * cn=configuration,<ForestRootDN> -filter (objectclass=ntdsdsa)
Incoming search terms:
- useful active directory queries
- useful AD queries
- active directory commands
- active directory script commands -powershell
- command line active directory user query
- command line AD query with filter
- command line query active directory
- Query Active Directory Command Line
- Userful AD command