473,898 Members | 2,695 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 15915

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
5462
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
25122
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 System.DirectoryServices.DirectorySearcher();
9
2305
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
1385
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
4075
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 three info of user and make a search in Active Directory.
3
2058
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 reference: -----------------------------
18
23797
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
4067
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
5499
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 redirected to a new page. if not they will be prompt to try again for username and password. What...
0
9992
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11254
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10853
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10943
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10480
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9658
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8034
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5876
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3303
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.