C# .NET - The server is unwilling to process the request. - ActiveDirectory

Asked By Anandh Ramanujam on 03-Apr-12 11:11 AM

Hi,

Im trying to add the groups to the user. But it gives error while commitchanges:
The server is unwilling to process the request.

Please find the code below.

for(intx = 0; x < arrGroup.Length; x++)
{
DirectoryEntry FilterEntry = newDirectoryEntry(http://forums.asp.net/t/1786411.aspx/1?The+server+is+unwilling+to+process+the+request+);
DirectorySearcher
Search = newDirectorySearcher(FilterEntry);
Search.Filter =string.Format("(&(objectclass=group)(CN=" + arrGroup[x] +
"))");
Search.PropertiesToLoad.Add(
"adspath");
SearchResultCollectionresultcol = Search.FindAll();
if(resultcol.Count > 0)
{
foreach (SearchResult sr
inresultcol)
{
foreach (string PropertyName
insr.Properties.PropertyNames)
{
foreach (object retentry
insr.Properties[PropertyName])
{
stringGroupDN;
GroupDN =
null;
GroupDN ="" + retentry.ToString() +
"";
DirectoryEntry
de = new
DirectoryEntry(GroupDN);
de.Properties[
"Member"].Add(UserCN);
de.CommitChanges();
twGroup.WriteLine("Assigned as member to the group " +
" -- "+ arrGroup[x]);
de.Close();
}
}

}
}
else
twGroup.WriteLine("Group " +" -- " + arrGroup[x] +" -- " +
" not found");
}


When Iam try creating a new account, then it will add the groups to the users successfully. But when I enable the disabled account and then trying to add the groups, then only it creates the problem like The server is unwilling to process the request

Can u pls help me in this regard....

Suchit shah replied to Anandh Ramanujam on 03-Apr-12 11:29 AM
I think for that first of all you required to check the Rights for service account which you are using . this type of error also come when there is insufficient privileges and have you tried with Domain Admin account ? 
Anandh Ramanujam replied to Suchit shah on 03-Apr-12 11:37 AM

Yes, I am the using dedicated account for this AD processes.

Everything is working fine with this account. Is there anything to be cautious when enable the accout from disabled state. I think some thing is there but i couldnt find....
Suchit shah replied to Anandh Ramanujam on 03-Apr-12 03:02 PM
You have to enable schema changes in registry. Open regedit and localte
HKLM\System\CurrentControlSet\Services\NTDS\Parameters\Schema Update allowed
to 1.


See http://support.microsoft.com/?kbid=285172