473,581 Members | 2,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_CL EAR = 1
' Declarations are commented for use with VBScript
Dim oRootDSE 'As IADs
Dim oConn 'As ADODB.Connectio n
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("A DODB.Connection ")
Set oRootDSE = GetObject("LDAP ://RootDSE")

oConn.Provider = "ADsDSOObje ct"
oConn.Open "ADs Provider"

strQuery = "<LDAP://" & oRootDSE.Get("s chemaNamingCont ext")
& ">;(&(objectCla ss=attributeSch ema)(cn=" & strAttribute &
"));cn,adspath; subtree"
Set oRecordset = oConn.Execute(s trQuery)
oRecordset.Move First
strADsPath = oRecordset.Fiel ds("ADsPath") 'store the path of the object in
the schema

Set oAttribute = GetObject(strAD sPath) 'Get the object in the schema
If bReplicate Then
oAttribute.Put "isMemberOfPart ialAttributeSet ", True 'Set the property
to true
Else
oAttribute.PutE x ADS_PROPERTY_CL EAR, "isMemberOfPart ialAttributeSet ", 0
'Clear the property
End If

'Write to schema
oAttribute.SetI nfo

'Clean Up
Set oAttribute = Nothing
Set oRootDSE = Nothing
oRecordset.Clos e
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(Cont enedorUsuario v_objContenedor Usuario) {

string strFullName = v_objContenedor Usuario.obtener Nombre() +" "+
v_objContenedor Usuario.obtener PrimerApellido( ) +" "+
v_objContenedor Usuario.obtener SegundoApellido ();

DirectoryEntry objNewUser = null;

try

{

/* get the current user */

objNewUser = getDirectoryEnt ry(v_objContene dorUsuario.getU niqueId());

}

catch(Exception e)

{

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

}

if (objNuevoUsuari o == null)

{

throw new Exception("Usua rio 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["isMemberOfPart ialAttributeSet "].Value =
objBoolean;

/* seccion de atributos obligatorios de Active Directory */

invocarPropieda d(ref objNuevoUsuario ,"name",strNomb reCompleto);

invocarPropieda d(ref
objNuevoUsuario ,"givenName",v_ objContenedorUs uario.obtenerNo mbre());

invocarPropieda d(ref
objNuevoUsuario ,"Description", v_objContenedor Usuario.obtener Descripcion());

invocarPropieda d(ref
objNuevoUsuario ,"samAccountNam e",v_objContene dorUsuario.obte nerLogin());

/* Seccion de atributos extendidos de Active Directory */

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

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute1",v_objCo ntenedorUsuario .obtenerCedula( )
);

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute2",v_objCo ntenedorUsuario .obtenerCorreoE l
ectronico());

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute3",v_objCo ntenedorUsuario .obtenerDeparta m
ento());

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute4",v_objCo ntenedorUsuario .obtenerEntidad (
));

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute5",v_objCo ntenedorUsuario .obtenerJefeDir e
cto());

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute6",v_objCo ntenedorUsuario .obtenerNombre( )
);

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute7",v_objCo ntenedorUsuario .obtenerPrimerA p
ellido());

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute8",v_objCo ntenedorUsuario .obtenerPuesto( )
);

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute9",v_objCo ntenedorUsuario .obtenerSegundo A
pellido());

invocarPropieda d(ref
objNuevoUsuario ,"extensionAttr ibute10",v_objC ontenedorUsuari o.obtenerTelefo n
o());

/* solamente modifica el password si esta definido */

if(v_objContene dorUsuario.obte nerClave() != "" &&
v_objContenedor Usuario.obtener Clave() != null)

{

objNuevoUsuario .Invoke("SetPas sword", new object[]
{v_objContenedo rUsuario.obtene rClave() });

}

#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 convertirUsuari oADataSet(objNu evoUsuario);

}

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 15871

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

Similar topics

0
2785
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 found this article: http://support.microsoft.com/default.aspx?scid=kb;EN-US;248717 that says the following: ..........................
10
5422
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 machine then it works again. here is one of the method where am calling the AD public bool UserExist(string UserName) {
1
25075
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 you could help me. Here's the code: -------------------------- System.DirectoryServices.DirectorySearcher DSESearcher = new...
9
2285
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 browser. What is the issue? Thanks, Jim Server Error in '/psnRequest' Application....
1
1372
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 ex As Exception label1.Text = "this happens quite a bit" End Try
10
4044
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 Pop up windows Authentication box so that user will give his userId, Password & domain name for authenticaion. After that I want to take these...
3
2034
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 will repeatedly occur for a period of time then start working fine again. ASP.NET application uses windows authentication. I am attaching the code for...
18
23774
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 code/examples? Thanks in advance, Arthur
1
4050
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 role within Active directory. For example, Region1 has 4 sites, Region 2 has 3 sites and so forth. All the sites are held in a single database table.
5
5485
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 send an LDAP query into the active directory located on a different server and it will check for existing users. If the users exist they will be...
0
7804
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3832
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1409
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1144
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.