DSQuery all servers in Active Directory

July 7, 2014

DSQUERY

How to use DSQUERY to find computers in Active Directory ?

Intro:

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Here a few examples;

1. Find all computers:

dsquery * -Filter "(&(objectClass=computer)(operatingSystem=*))" -Attr name operatingSystem -limit 100000000

 

2. Find only Servers:

dsquery * -Filter "(&(objectClass=computer)(operatingSystem=Windows Server *))" -Attr name operatingSystem -limit 100000000

 

3. Find Windows Server 2012:

dsquery * -Filter "(&(objectClass=computer)(operatingSystem=Windows Ser* 2012 *))" -Attr name operatingSystem -limit 100000000

 

4. Find all Windows Server 2008:

dsquery * -Filter "(&(objectClass=computer)(operatingSystem=Windows Serv* 2008 *))" -Attr name operatingSystem -limit 100000000

 

5. Find only Windows Server 2008 R2:

dsquery * -Filter "(&(objectClass=computer)(operatingSystem=Windows Serv* 2008 *R2*))" -Attr name operatingSystem -limit 100000000

 

6. Find Windows 8.1 computers:

dsquery * -Filter "(&(objectClass=computer)(operatingSystem=*8.1*))" -Attr name operatingSystem -limit 100000000

.

Skepper

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.