I have lots of features in AdFind that I like, but I have to say I am particularly happy with the –mvfilter function. Its something so simple and so widely requested yet NOT done by most LDAP clients… You want this functionality when you only want to see the values in the attribute that match specific things you are looking for… For example, I want all email addresses in the proxyaddresses attribute that has the string @company.com in it so I can clean them up… How hard, seriously, should that be? I initially added it with only about 30 minutes of coding and I have now expanded it a little for V01.39.00. At some point I hope to actually add regular expression capability to the matching.
The first update is to allow you to specify multiple values for a single attribute. So for example you could only output proxyaddress values that have smtp: in them, now you could specify that you want to see smtp: and x400:.
The second update is to match on the attribute name only. Previously I took the entire string returned by Active Directory for the attribute and matched against that. In most cases this is fine and truthfully most people are looking at the screen going? Huh? What’s the difference? The difference comes in when doing some more advanced things like working with attributes you want returned in their binary formats or values that come back with ranging. When that occurs the attribute has a ;binary or ;range= string appended to the attribute name so if you are matching on someattrib=joe if you get back someattrib;binary=joe the match would fail because the attribute name wasn’t matching up. I have made that more intelligent and now someattrib=joe will check attributes named someattrib as well as someattrib;someextension.
A simple example showing something cool you can do because of these two updates. We will pull replication metadata for an object… No we will pull replication metadata for multiple objects based on an LDAP filter. I want to do this because it is something that can’t be done by repadmin which is the first tool everyone else thinks of when they think to get replication metadata. ;) Don’t get me wrong, repadmin is extremely cool, I like it a lot, I just like AdFind better for getting replication metadata.
Retrieve the replication metadata info for proxyAddress, mailnickname, and homeMDB for every object with a mailnickname value.
F:\Dev\Current\CPP\AdFind\Debug>adfind -default -f mailnickname=* -sc objsmeta -mvfilter msDS-ReplAttributeMetaData=mailnickname;msDS-ReplAttributeMetaData=proxyaddresses;msDS-ReplValueMetaData=homemdb
AdFind V01.39.00cpp ***BETA*** Joe Richards (joe@joeware.net) December 2008
Using server: JOEWARE-DC1.joeware.local:389
Directory: Windows Server 2003
Base DN: DC=joeware,DC=local
dn:CN=23001_Test,OU=test,DC=joeware,DC=local
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 mailNickname
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 proxyAddresses
>msDS-ReplValueMetaData;binary: homeMDB 119164 Default-First-Site-Name\DC2 1706316 2008/06/06-16:20:59 1 (+)CN=DB1,CN=SG-Default,CN=InformationStore,CN=MBX01,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Org,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=joeware,DC=local
dn:CN=23002_Test,OU=test,DC=joeware,DC=local
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 mailNickname
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 proxyAddresses
>msDS-ReplValueMetaData;binary: homeMDB 119160 Default-First-Site-Name\DC2 1706318 2008/06/06-16:20:59 1 (+)CN=DB1,CN=SG-Default,CN=InformationStore,CN=MBX01,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Org,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=joeware,DC=local
dn:CN=23003_Test,OU=test,DC=joeware,DC=local
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 mailNickname
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 proxyAddresses
>msDS-ReplValueMetaData;binary: homeMDB 119162 Default-First-Site-Name\DC2 1706320 2008/06/06-16:20:59 1 (+)CN=DB1,CN=SG-Default,CN=InformationStore,CN=MBX01,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Org,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=joeware,DC=local
<SNIP>
You may think… so what… well here is what it would look like with AdFind without the multivalue filtering….
F:\Dev\Current\CPP\AdFind\Debug>adfind -e -default -f mailnickname=* -sc objsmeta
AdFind V01.39.00cpp ***BETA*** Joe Richards (joe@joeware.net) December 2008
Using server: JOEWARE-DC1.joeware.local:389
Directory: Windows Server 2003
Base DN: DC=joeware,DC=local
dn:CN=23001_Test,OU=test,DC=joeware,DC=local
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 accountExpires
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 cn
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 codePage
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 countryCode
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 dBCSPwd
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 displayName
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 homeMTA
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 instanceType
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 legacyExchangeDN
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 lmPwdHistory
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 logonHours
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 mailNickname
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 mail
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 msExchALObjectVersion
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 msExchHomeServerName
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 msExchMailboxGuid
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 msExchMailboxSecurityDescriptor
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 msExchPoliciesIncluded
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 msExchUserAccountControl
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 name
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 ntPwdHistory
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 nTSecurityDescriptor
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 objectCategory
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 objectClass
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 objectSid
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 primaryGroupID
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 proxyAddresses
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 pwdLastSet
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 sAMAccountName
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 sAMAccountType
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 showInAddressBook
>msDS-ReplAttributeMetaData;binary: 119137 Default-First-Site-Name\JOEWARE-DC1 119137 2008/06/06-16:21:29 1 supplementalCredentials
>msDS-ReplAttributeMetaData;binary: 119156 Default-First-Site-Name\DC2 1706317 2008/06/06-16:20:59 1 textEncodedORAddress
>msDS-ReplAttributeMetaData;binary: 119136 Default-First-Site-Name\JOEWARE-DC1 119136 2008/06/06-16:21:29 1 unicodePwd
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 userAccountControl
>msDS-ReplAttributeMetaData;binary: 119135 Default-First-Site-Name\JOEWARE-DC1 119135 2008/06/06-16:21:29 1 whenCreated
>msDS-ReplValueMetaData;binary: homeMDB 119164 Default-First-Site-Name\DC2 1706316 2008/06/06-16:20:59 1 (+)CN=DB1,CN=SG-Default,CN=InformationStore,CN=MBX01,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Org,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=joeware,DC=local
dn:CN=23002_Test,OU=test,DC=joeware,DC=local
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 accountExpires
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 cn
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 codePage
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 countryCode
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 dBCSPwd
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 displayName
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 homeMTA
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 instanceType
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 legacyExchangeDN
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 lmPwdHistory
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 logonHours
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 mailNickname
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 mail
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 msExchALObjectVersion
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 msExchHomeServerName
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 msExchMailboxGuid
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 msExchMailboxSecurityDescriptor
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 msExchPoliciesIncluded
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 msExchUserAccountControl
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 name
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 ntPwdHistory
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 nTSecurityDescriptor
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 objectCategory
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 objectClass
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 objectSid
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 primaryGroupID
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 proxyAddresses
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 pwdLastSet
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 sAMAccountName
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 sAMAccountType
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 showInAddressBook
>msDS-ReplAttributeMetaData;binary: 119141 Default-First-Site-Name\JOEWARE-DC1 119141 2008/06/06-16:21:29 1 supplementalCredentials
>msDS-ReplAttributeMetaData;binary: 119157 Default-First-Site-Name\DC2 1706319 2008/06/06-16:20:59 1 textEncodedORAddress
>msDS-ReplAttributeMetaData;binary: 119140 Default-First-Site-Name\JOEWARE-DC1 119140 2008/06/06-16:21:29 1 unicodePwd
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 userAccountControl
>msDS-ReplAttributeMetaData;binary: 119139 Default-First-Site-Name\JOEWARE-DC1 119139 2008/06/06-16:21:29 1 whenCreated
>msDS-ReplValueMetaData;binary: homeMDB 119160 Default-First-Site-Name\DC2 1706318 2008/06/06-16:20:59 1 (+)CN=DB1,CN=SG-Default,CN=InformationStore,CN=MBX01,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Org,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=joeware,DC=local
dn:CN=23003_Test,OU=test,DC=joeware,DC=local
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 accountExpires
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 cn
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 codePage
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 countryCode
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 dBCSPwd
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 displayName
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 homeMTA
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 instanceType
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 legacyExchangeDN
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 lmPwdHistory
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 logonHours
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 mailNickname
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 mail
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 msExchALObjectVersion
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 msExchHomeServerName
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 msExchMailboxGuid
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 msExchMailboxSecurityDescriptor
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 msExchPoliciesIncluded
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 msExchUserAccountControl
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 name
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 ntPwdHistory
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 nTSecurityDescriptor
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 objectCategory
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 objectClass
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 objectSid
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 primaryGroupID
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 proxyAddresses
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 pwdLastSet
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 sAMAccountName
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 sAMAccountType
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 showInAddressBook
>msDS-ReplAttributeMetaData;binary: 119145 Default-First-Site-Name\JOEWARE-DC1 119145 2008/06/06-16:21:29 1 supplementalCredentials
>msDS-ReplAttributeMetaData;binary: 119158 Default-First-Site-Name\DC2 1706321 2008/06/06-16:20:59 1 textEncodedORAddress
>msDS-ReplAttributeMetaData;binary: 119144 Default-First-Site-Name\JOEWARE-DC1 119144 2008/06/06-16:21:29 1 unicodePwd
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 userAccountControl
>msDS-ReplAttributeMetaData;binary: 119143 Default-First-Site-Name\JOEWARE-DC1 119143 2008/06/06-16:21:29 1 whenCreated
>msDS-ReplValueMetaData;binary: homeMDB 119162 Default-First-Site-Name\DC2 1706320 2008/06/06-16:20:59 1 (+)CN=DB1,CN=SG-Default,CN=InformationStore,CN=MBX01,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Org,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=joeware,DC=local
<SNIP>
as you can see, the filtering makes the output much more useful, you get only what you need.