More LDAP Query Examples and more AD Specific LDAP Query Examples
(sAMAccountType=805306369)
or
(objectCategory=computer)
BTW: We have a table of possible SAMAccountType values.
(&(objectCategory=Computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))
(&(objectCategory=nTDSDSA)(options:1.2.840.113556.1.4.803:=1))
(!(primaryGroupID=516))
(!(servicePrincipalName=MSOMHSvc/*))
(|(name=*1)(name=*3)(name=*5)(name=*7)(name=*9))
(&(objectClass=computer)(userAccountControl:1.2.840.113556.1.4.803:=2))
For information on why this works see how to use Filtering for Bit Fields.
(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server 2003*)))
(&(&(&(samAccountType=805306369)(primaryGroupID=516)(objectCategory=computer)(operatingSystem=Windows Server 2003*))))
(&(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server 2008*))))
(&(&(&(objectCategory=Computer)(operatingSystem=Windows 2000 Professional)(operatingSystemServicePack=Service Pack 4))))
(&(&(&(&(&(&(&(objectCategory=Computer)(operatingSystem=Windows XP Professional)(operatingSystemServicePack=Service Pack 2))))))))
(&(&(&(&(&(&(&(objectCategory=Computer)(operatingSystem=Windows XP Professional)(operatingSystemServicePack=Service Pack 3))))))))
(&(&(&(&(sAMAccountType=805306369)(objectCategory=computer)(operatingSystem=Windows Vista*)(operatingSystemServicePack=Service Pack 1)))))
| LDAP Attribute | Remark |
|---|---|
| description | Computer description (in AD) |
| distinguishedName | DN: OU location of the computer account can be read from here. No wildcard matching possible! |
| dNSHostName | FQDN |
| location | Location field |
| memberOf | Groups the computer account is a member of. No wildcard matching possible! |
| name | Netbios computer name |
| operatingSystem | e.g. Windows Server 2003 |
| operatingSystemServicePack | e.g. Service Pack 1 |
| operatingSystemVersion | e.g. 5.2 (3790) |
| primaryGroupID | 515: Computers 516: Domain Controllers |
| sAMAccountName | Computer account name (name$) |
| sAMAccountType | always 805306369 (computer account) |
| servicePrincipalName | list of registered SPNs |