473,466 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

setting password to ADS object

HI,

I am getting an error "Exception has been thrown by the target of an invocation" when I executing the following code.
User "abc" is already created under the OU(Sas).

Try
Dim myDirectoryEntry As DirectoryEntry
myDirectoryEntry = New DirectoryEntry("LDAP://myserver/CN=abc,OU=Sas,DC=com")

myDirectoryEntry.Invoke("SetPassword", "NewPassword")
myDirectoryEntry.CommitChanges()
Catch ex As Exception
MsgBox(ex.message)
End Try
any one please give suggestion about it.

(any permission we have to set in ADS/IIS)

--------------------------------
From: vishwa h

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>PBtlyKYXWE2T61a2A6s5Sw==</Id>
Jul 21 '05 #1
2 1539
On Mon, 07 Jun 2004 06:00:20 -0700, vishwa h via .NET 247 <an*******@dotnet247.com> wrote:

¤ HI,
¤
¤ I am getting an error "Exception has been thrown by the target of an invocation" when I executing the following code.
¤ User "abc" is already created under the OU(Sas).
¤
¤ Try
¤ Dim myDirectoryEntry As DirectoryEntry
¤ myDirectoryEntry = New DirectoryEntry("LDAP://myserver/CN=abc,OU=Sas,DC=com")
¤
¤ myDirectoryEntry.Invoke("SetPassword", "NewPassword")
¤ myDirectoryEntry.CommitChanges()
¤ Catch ex As Exception
¤ MsgBox(ex.message)
¤ End Try
¤
¤
¤ any one please give suggestion about it.
¤
¤ (any permission we have to set in ADS/IIS)

Well yes you would need permissions to reset a users password. In addition, I don't think you need
to include "myserver" in your LDAP string. Should just be user, OU container and domain.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 21 '05 #2
>I am getting an error "Exception has been thrown by the target of an invocation" when I executing the following code.
User "abc" is already created under the OU(Sas).

Try
Dim myDirectoryEntry As DirectoryEntry
myDirectoryEntry = New DirectoryEntry("LDAP://myserver/CN=abc,OU=Sas,DC=com")

myDirectoryEntry.Invoke("SetPassword", "NewPassword")
myDirectoryEntry.CommitChanges()
Catch ex As Exception
MsgBox(ex.message)
End Try


Well first off - did your bind succeed ?? Can you access properties of
the "myDirectoryEntry" object? Is your LDAP bind string really
correct??

Where EXACTLY does the error occur? On the .Invoke("SetPassword",..
line, or the .CommitChanges() line?

Next: when you call SetPassword on the underlying object, you don't
need to call .CommitChanges() afterwards - the SetPassword will save
its change to the AD data store right away.

Lastly: you could try to get the ADSI native COM object for the entry,
and call .SetPassword on that interface directly (using old-style ADSI
COM calls).

Marc

================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Jul 21 '05 #3

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

Similar topics

4
by: Hollywood | last post by:
I'm using XML serialization to produce the following XML document: <TestDoc xmlns:srd="some-url"> <Additional> <Security> <srd:Login>login_id</srd:Login> <srd:Password>password</srd:Password>...
0
by: Nate Hekman | last post by:
I'm trying to set up a Membership/Role Provider for an ASP.NET 2.0 beta 2 site using SqlMembershipProvider, and am having problems configuring SQL Server. I'm comfortable with ASP.NET but very...
4
by: r_burgess | last post by:
TheNewUser.Invoke("SetPassword", New Object() {"123"}) Does anyone have any idea why that call wouldn't work, even though I have supplied credentials which are fully capable of setting and...
0
by: Jim_H | last post by:
I am trying to set the Credentials property of my web service proxy and I cannot seem to get anything to work. I am calling a remote asmx page from an aspx and they each reside on different web...
10
by: Sridhar | last post by:
HI, I am having problems setting up a website so that it will be available only inside the domain. We have three servers. One is iis server and second one is internal server and the third one is...
4
by: Bob | last post by:
I'm just starting PHP and MySQL - and really like the book by Welling and Thomsom. I've installed MySQL on my WinXP desktop, along with Apache and PHP. I have not figured out how to set a...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
9
by: =?Utf-8?B?Sm9l?= | last post by:
OK, I have code that I used in a standard windows app that would create an account and then set the password. I have taken that code and am using it in a Web App. Here's the code: ...
8
by: Michael Howes | last post by:
I have some code that manages local user logins. When I create a new user I want to set the password to expire every x days and the number of failed login attempts before the account is...
0
by: shashank kadge | last post by:
You can set it to integer, if u dont want to use ADS constant. 544 - to enable the user object 66048 - for Password never expires in addition to enabling user object. 66080 - for enabling user...
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...
0
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,...
0
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...
0
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,...
1
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...
0
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...
0
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,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.