473,383 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Active Directory Error - The server is unwilling to process the request

Hi People, when I try to modify an active directory user programatically, I
receive the following exception:

The server is unwilling to process the request

Reading the microsoft web site, I found this article:
http://support.microsoft.com/default...b;EN-US;248717 that says the
following:

..........................

To Make Modifications Using ADSI Scripts
Active Directory Services Interfaces (ADSI) can make modifications to the
schema through its Lightweight Directory Access Protocol (LDAP) provider.
The code below determines the location of the schema, bind to the attribute
in the schema, and make the necessary changes to force it to replicate to
the GC.
Const ADS_PROPERTY_CLEAR = 1
' Declarations are commented for use with VBScript
Dim oRootDSE 'As IADs
Dim oConn 'As ADODB.Connection
Dim oRecordset 'As ADODB.Recordset
Dim strAttribute 'As String
Dim strADsPath 'As String
Dim oAttribute 'As IADs
Dim bReplicate 'As Boolean

strAttribute = "Department" 'Replace with the name of the attribute to
change replication
bReplicate = True 'Replicate to GC True/False

Set oConn = CreateObject("ADODB.Connection")
Set oRootDSE = GetObject("LDAP://RootDSE")

oConn.Provider = "ADsDSOObject"
oConn.Open "ADs Provider"

strQuery = "<LDAP://" & oRootDSE.Get("schemaNamingContext")
& ">;(&(objectClass=attributeSchema)(cn=" & strAttribute &
"));cn,adspath;subtree"
Set oRecordset = oConn.Execute(strQuery)
oRecordset.MoveFirst
strADsPath = oRecordset.Fields("ADsPath") 'store the path of the object in
the schema

Set oAttribute = GetObject(strADsPath) 'Get the object in the schema
If bReplicate Then
oAttribute.Put "isMemberOfPartialAttributeSet", True 'Set the property
to true
Else
oAttribute.PutEx ADS_PROPERTY_CLEAR, "isMemberOfPartialAttributeSet", 0
'Clear the property
End If

'Write to schema
oAttribute.SetInfo

'Clean Up
Set oAttribute = Nothing
Set oRootDSE = Nothing
oRecordset.Close
oConn.Close
Set oConn = Nothing
Set oRecordset = Nothing
If the above registry change is not made, the following error occurs
when attempting to run the script:

Error -2147016651 (80072035): Automation error. The server is unwilling to
process the request.
.........................
My code is the following:

public DataSet modifyUser(ContenedorUsuario v_objContenedorUsuario) {

string strFullName = v_objContenedorUsuario.obtenerNombre() +" "+
v_objContenedorUsuario.obtenerPrimerApellido() +" "+
v_objContenedorUsuario.obtenerSegundoApellido();

DirectoryEntry objNewUser = null;

try

{

/* get the current user */

objNewUser = getDirectoryEntry(v_objContenedorUsuario.getUnique Id());

}

catch(Exception e)

{

throw new Exception("Usuario no Existe y no se puede modificar");

}

if (objNuevoUsuario == null)

{

throw new Exception("Usuario no Existe y no se puede modificar");

}

try

{

#region invoke Properties
/* si no se setea esta propiedad, provoca una exception de: The server is
unwilling to process the request,

* para mas detalles ver:
http://support.microsoft.com/default...b;EN-US;248717 */

Boolean objBoolean = true;

objNuevoUsuario.Properties["isMemberOfPartialAttributeSet"].Value =
objBoolean;

/* seccion de atributos obligatorios de Active Directory */

invocarPropiedad(ref objNuevoUsuario,"name",strNombreCompleto);

invocarPropiedad(ref
objNuevoUsuario,"givenName",v_objContenedorUsuario .obtenerNombre());

invocarPropiedad(ref
objNuevoUsuario,"Description",v_objContenedorUsuar io.obtenerDescripcion());

invocarPropiedad(ref
objNuevoUsuario,"samAccountName",v_objContenedorUs uario.obtenerLogin());

/* Seccion de atributos extendidos de Active Directory */

/* Para detalles ver:
http://www.microsoft.com/latam/techn...ws2k/chapt-20/ */

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute1",v_objContene dorUsuario.obtenerCedula()
);

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute2",v_objContene dorUsuario.obtenerCorreoEl
ectronico());

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute3",v_objContene dorUsuario.obtenerDepartam
ento());

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute4",v_objContene dorUsuario.obtenerEntidad(
));

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute5",v_objContene dorUsuario.obtenerJefeDire
cto());

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute6",v_objContene dorUsuario.obtenerNombre()
);

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute7",v_objContene dorUsuario.obtenerPrimerAp
ellido());

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute8",v_objContene dorUsuario.obtenerPuesto()
);

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute9",v_objContene dorUsuario.obtenerSegundoA
pellido());

invocarPropiedad(ref
objNuevoUsuario,"extensionAttribute10",v_objConten edorUsuario.obtenerTelefon
o());

/* solamente modifica el password si esta definido */

if(v_objContenedorUsuario.obtenerClave() != "" &&
v_objContenedorUsuario.obtenerClave() != null)

{

objNuevoUsuario.Invoke("SetPassword", new object[]
{v_objContenedorUsuario.obtenerClave() });

}

#endregion

/* Hace "Commit" de los cambios, para asegurar que se realicen en el Active
Directory */

objNuevoUsuario.CommitChanges();

/* se retorna el objeto correspondiente al nuevo usuario */

return convertirUsuarioADataSet(objNuevoUsuario);

}

catch(Exception e)

{

throw e;

}

}

I'm using a user with full rights to modify the active directory. Any idea
why the The server is unwilling to process the request exception???
Jul 21 '05 #1
0 15818

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: microsoft | last post by:
Hi People, when I try to modify an active directory user programatically, I receive the following exception: The server is unwilling to process the request Reading the microsoft web site, I...
10
by: huzz | last post by:
I have web application that quaries the Active Directory to get user details.. everything works fine but someday I'll get System.Runtime.InteropServices.COMExection and if I restart the client...
1
by: Angelo | last post by:
Hi, I've been trying to create a user in Active Directory. So far this works, however default the user is disabled. I've been trying so much code to enable the user, but without success, perhaps...
9
by: JTrigger | last post by:
When I compile my project using the IDE on a development machine it works just fine. When I compile it on the server using csc.exe, I get the following error when I try to bring it up in the web...
1
by: Derek Martin | last post by:
This seems to be a common problem in ASP.Net: Try Dim mystuff As DirectoryEntry = Session("myDirectoryEntry") mystuff.Properties("extensionAttribute1")(0) = "yes" mystuff.CommitChanges() Catch...
10
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to...
3
by: Susan | last post by:
Hello all, My ASP.NET application seems to have intermittent problems when connecting to Active Directory server. Most of the time the Active Directory app works fine then suddenly fails and...
18
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample...
1
by: Tim | last post by:
Folks, I have 3 loosely linked problems which I am would appreciate feedback on. 1). T-Sql and Active directory roles. We want to be able to control access to data within a table based on a...
5
by: wak0 | last post by:
Hi, I hope you guys can help me. I need to build a form that request username and password on ASP not ASP.net (sorry to clarify but i got some responses in other forums in .net) This form will...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.