Peoplepicker-searchadcustomquery: Stsadm property (Office SharePoint Server)

Applies To: Office SharePoint Server 2007

This Office product will reach end of support on October 10, 2017. To stay supported, you will need to upgrade. For more information, see , Resources to help you upgrade your Office 2007 servers and clients.


Topic Last Modified: 2017-03-02


Permits the administrator to set the custom query that is sent to Active Directory.

The People Picker can only do wildcard searches for Active Directory Windows group names. With any role provider other than the ones included with Microsoft Office SharePoint Server 2007, the role provider lookup is specific to the entire name. For example, if you have a group called "Readers" and you enter "Read" in the Select People and Groups dialog box, it does not find your group. If you enter "Readers", the search succeeds.


When the people picker performs a search, it queries the Domain Controller using a LDAP Global Catalog Search Request. This means that when you create a new Active Directory custom attribute or use an Active Directory attribute you need to ensure that they are included in the Global Catalog, you can do this by checking the Replicate to the Global Catalog option in the Active Directory attribute properties. If this option is not checked you will not be able to reference this attribute in your People Picker filter. If the property value is not a correct Active Directory query, People Picker fails. Also, if the searched attribute is not an indexed attribute in Active Directory, the performance of Active Directory is very slow.
For additional information on people picker and search queries, see SharePoint PeoplePicker Filtering Active Directory accounts by using LDAP queries and custom attributes returns no results


stsadm -o setproperty

-propertyname peoplepicker-searchadcustomquery

-propertyvalue <custom query string>

**\[-url\]** *\<URL\>*

The syntax for the getproperty operation is:

stsadm -o getproperty

-propertyname peoplepicker-searchadcustomquery

**\[-url\]** *\<URL\>*


You can substitute -pn for -propertyname and -pv for -propertyvalue.

Property values


The following table shows possible values.

Name Value


Gets or sets the name of the property.


A valid string that specifies the custom query. Some valid examples are:

  • (SomeAdAttribute={0})

  • (SomeAdAttribute={0}*)

  • (SomeAdAttribute={0})(AnotherAdAttribute={0})

SomeAdAttribute and AnotherAdAttribute are the names of some indexed attributes in Active Directory.


Typically, a path to the URL of the Web application, in the form http://server_name.


Create a custom query in Active Directory

To create a query that searches on the last name, use the following syntax:

stsadm -o setproperty -pn peoplepicker-searchadcustomquery -pv (sn={0}*)

To view the current setting for the searchadcustomquery property, use the following syntax:

stsadm -o getproperty -pn peoplepicker-searchadcustomquery