Error Message When You Try To Remove People Picker Custom Filter “Unexpected end of file has occurred. The following elements are not closed: Alternate Domains. Line 27, position 2”

I came across a pretty interesting problem on one of my environments..wondering someone might have gone through a similar scenario ,documenting this .

People Picker can do wildcard searches for Active Directory Windows group names. There are multiple people picker property one can set and I have listed them below . The scope of this post is not to discuss on these properties as there are already very good articles available .

activedirectorysearchtimeout

searchadcustomfilter

distributionlistsearchdomains

onlysearchwithinsitecollection

searchadforests

searchadcustomquery

nowindowsaccountsfornonwindowsauthenticationmode 

I have seen people setting up “searchadcustomfilter” property on the people picker. This enables a farm administrator to specify a unique search query. Now the issue I am going to discuss happens if the following conditions are true

your farm is on April 09 CU.

if you have any alternate access setting for web application which has 5 incoming URLs

people picker property set example “searchadcustomfilter”.

Run the below command and you will be able to see the property value

stsadm -o getproperty -url <URL of webapp> -pn peoplepicker-searchadcustomfilter

Assume you want to either set the property to a specific filter or reset the property and set it to default.<Note : Its assumed that you will have working copy of backup of the environment and an output of the get property before you run the command below>.

Example to set a people picker property

stsadm -o setproperty -url <URL of webapp> -pn peoplepicker-searchadcustomfilter –pv “ property value “

You will get an error as in the print screen below

image

Example to reset the people picker searchadcustomfilter property to default.

stsadm -o setproperty -url <URL of webapp> -pn peoplepicker-searchadcustomfilter –pv “ “

You should see same error message on the command prompt.

Unexpected end of file has occurred. The following elements are not closed: Alternate Domains. Line 32, position 11” Note the line and the position number may vary on your environment.

ULS logs verbose should give you similar message as below

STSADM.EXE (0x237C) 0x2190 Windows SharePoint Services Topology 8dyc High Setting backwards compatible virtual server property failed, vs: SPWebApplication Name= URL =SPWebService key: defaultzoneoutgoingurl value: https://example/pages/default.aspx . Unexpected end of file while parsing Name has occurred. Line 28, position 16.

Alternate access mappings are stored in the following places within SharePoint databases. (Note: Editing of SharePoint databases is not supported . For more information read https://support.microsoft.com/kb/841057 )

a. config DB,  dbo.Objects table
b. content DB, in the table dbo.DatabaseInformation . For 'AlternateAccessMappingXml' the value (nvarchar(1023)) is an Xml string containing all the AAMs. Unexpected end of file has occurred” that we see on errors is the xml string stored in the line ‘AlternateAccessMappingXml’ .After this exception is thrown, you will not be able to add or delete an Alternate Access Mapping. So trying to temporarily remove a AAM entry and making the changes to people picker property will not be an option as well.

Fix:-

Unable to delete AAM entries was a known issue after April 09 CU and was fixed in August 2009 CU. People picker properties are set per URL of web application. So when a reset operation for a property is done it tries a write operation and fails. In order to successfully remove/add the people picker property you need to upgrade the environment to August 2009 CU