You can do (&(objectclass=user)(manager= " & strMgr & ")(physicalDeliveryOfficeName=*))
If you want get all values you can use * as a wildcard. Or replace them with a variable to narrow your results. However its important to point out the "OU=blah, OU=blah blah" part of the distinquished name refers to the location of that object in the directory,
so you will have to make sure you get the path to those locations correct. You may want to populate a dropdown list with the manager distinquished names from AD instead. If you have all the managers in a security group or distribution list, this will be easy
because their names will be stored in that form already. And you can just retrieve their names from the list. You will of course want to display their full name in the display to choose from.
Is it possible to use the * wildcard for the first OU=? The way that my current employer has AD setup there are different office locations for 1 particular folder and they don't want to change so I need to get all of those records.
Is it possible to use the * wildcard for the first OU=? The way that my current employer has AD setup there are different office locations for 1 particular folder and they don't want to change so I need to get all of those records.
Thank you
You can use a wildcard just for that part if you wish, but you have to make sure the user object is located in that OU or the distinquished name will not be valid. The distinguished name is the person's full name and path to the object in AD. So if the account
for Bob Smith is located in root > Users > Finance, that listing of OUs in order will be displayed in his distinguished name.
What is it exactly that you are trying to search for? If you want to just pull all users out of a particular you can do that with your search filter for example: (&(ObjectClass=User)(OU=Finance))
I went in a different direction. I created a query based on the logged in user and then did a search on the directReports field. If that was filled in then create a query to get the information based on each of the user listed in that field. I was able
to get this to work.
Thanks for your help again. I think I am getting the hang of this. LOL
teklaw
Member
31 Points
20 Posts
Query and Wildcards
Dec 05, 2011 08:48 PM|LINK
Is there a way to query active directory on the managers field using wildcards?
manager's distinquished name
manager=CN=" & strMgr & ",OU=???,OU=Locations,DC=some value,DC=some value
I am looking to do a query using the above filter but the office location field as a wildcard. Can this be done?
Thank you
gww
Contributor
2143 Points
458 Posts
Re: Query and Wildcards
Dec 05, 2011 10:56 PM|LINK
You can do (&(objectclass=user)(manager= " & strMgr & ")(physicalDeliveryOfficeName=*))
If you want get all values you can use * as a wildcard. Or replace them with a variable to narrow your results. However its important to point out the "OU=blah, OU=blah blah" part of the distinquished name refers to the location of that object in the directory, so you will have to make sure you get the path to those locations correct. You may want to populate a dropdown list with the manager distinquished names from AD instead. If you have all the managers in a security group or distribution list, this will be easy because their names will be stored in that form already. And you can just retrieve their names from the list. You will of course want to display their full name in the display to choose from.
teklaw
Member
31 Points
20 Posts
Re: Query and Wildcards
Dec 06, 2011 12:44 PM|LINK
Is it possible to use the * wildcard for the first OU=? The way that my current employer has AD setup there are different office locations for 1 particular folder and they don't want to change so I need to get all of those records.
Thank you
gww
Contributor
2143 Points
458 Posts
Re: Query and Wildcards
Dec 06, 2011 05:48 PM|LINK
You can use a wildcard just for that part if you wish, but you have to make sure the user object is located in that OU or the distinquished name will not be valid. The distinguished name is the person's full name and path to the object in AD. So if the account for Bob Smith is located in root > Users > Finance, that listing of OUs in order will be displayed in his distinguished name.
What is it exactly that you are trying to search for? If you want to just pull all users out of a particular you can do that with your search filter for example: (&(ObjectClass=User)(OU=Finance))
teklaw
Member
31 Points
20 Posts
Re: Query and Wildcards
Dec 06, 2011 05:55 PM|LINK
I went in a different direction. I created a query based on the logged in user and then did a search on the directReports field. If that was filled in then create a query to get the information based on each of the user listed in that field. I was able to get this to work.
Thanks for your help again. I think I am getting the hang of this. LOL