Wednesday, March 14, 2012

C# : The server is unwilling to process the request

 

Busy doing some AD work with C#.

I’m creating the user, changing some of the attributes (e.g. setting “DONT_EXPIRE_PASSWORD”) and then setting the password.

Got the exception:

DirectoryServicesCOMException (0x80072035): The server is unwilling to process the request

Mr. Google to the rescue. After sorting through the huge pile of crap, found the answer.

You need to do it in the following order:

  • Create the user
  • Commit changes
  • Set the password
  • Commit changes
  • Change the attributes
  • Commit changes

i.e. Set the password BEFORE doing any attribute CRUD stuff.

Enjoy!

2 comments:

Anonymous said...

Thanks for the post. So much crud in a Google search and 99.99% of it is WRONGGGGGGGGG.

Admirador said...


Get same error:

http://stackoverflow.com/questions/39470446/server-is-unwilling-to-process-the-request-for-activedirectory

if I try using System.DirectoryServices.AccountManagement is working. Not errors, all is OK.