Querying Specific Operating System Types in Active Directory

In case you need to get a list of computer accounts that belong to a specific Operating System family, you can use DSQuery commands as listed in below commands:

Querying Windows 8 and Windows 8.1 Computers:

  • dsquery * -filter “(&(&(sAMAccountType=805306369)(objectCategory=computer)(operatingSystemVersion=6*)(operatingSystem=Windows 8*)))” -limit 0 -attr name operatingsystem

Querying Windows 7 Computers:

  • Dsquery * -filter “(&(&(sAMAccountType=805306369)(objectCategory=computer)(operatingSystemVersion=6*)(operatingSystem=Windows 7*)))” -limit 0 -attr name operatingsystem

About Nirmal Sharma

Nirmal Sharma is a MCSEx3, MCITP and Microsoft MVP in Directory Services. He specializes in directory services, Microsoft Azure, Failover clusters, Hyper-V, and System Center products and has been involved with Microsoft Technologies since 1994. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites and contributing to Health Packs for ADHealthProf.ITDynamicPacks.Net solutions. Nirmal can be reached at [email protected]

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top