473,386 Members | 1,674 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,386 software developers and data experts.

Setting password through directory services

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 changing a
password manually? (through an administrative acct)
In the program I just get done making a user and modifying its properties
(which works great) and then I commit changes. I then try to set the
password. An exception is thrown, and says the invocation has failed. Also in
the string is network path not found.
Can anyone tell me what I might try to remedy this situation? I have tried a
lot of things, but I feel as if I must be missing something....
(BTW, yes I know I need to use a secure password, but I will implement that
once I can get this simple code to work)
more of the code follows:

Dim TheNewUser As DirectoryEntry

TheNewUser = adentry3.Children.Add("cn=" & txtUserName.Text, "user")
TheNewUser.Properties("SAMAccountName").Value = txtUserName.Text
TheNewUser.Properties("userPrincipalName").Value = txtUserName.Text & "@" &
AD.Properties("dc").Value() & ".com"

Nov 21 '05 #1
4 1049
If your domain security policy requires complex passwords, then you'll get
TargetInvocationException when you try to set the password to "123". You'll
have to supply a password of at least 7 characters that contains upper and
lower case letters and at least one digit.

Cheers,
John Wadie

Nov 21 '05 #2
Are you able to add the user successfully to the Active Directory? Probably
the problem is related to the user creation, not to setting the password.
Check Active Directory Users and Computers after running your code, if the
creation is successful you should see the new user added but disabled.

Regards,
John Wadie

Nov 21 '05 #3
Yes, the user creation works fine, I am even able to manually enable the
account. I am 100% sure the set password invocation is returning my error.

""John Wadie"" wrote:
Are you able to add the user successfully to the Active Directory? Probably
the problem is related to the user creation, not to setting the password.
Check Active Directory Users and Computers after running your code, if the
creation is successful you should see the new user added but disabled.

Regards,
John Wadie

Nov 21 '05 #4
Try changing your line to

TheNewUser.Invoke("SetPassword", "123")

It works for me.

Regards,
John Wadie

Nov 21 '05 #5

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

Similar topics

16
by: John | last post by:
Hello. If I want to set up my first database and start using it in Dreamweaver what do I need to do? The book I'm working on has a CD with the database on. It is telling me to put it in the...
1
by: Dave | last post by:
Hi, I've read quite a few places where it recommends you use integrated security in your connection string to SQL Server I tried this in test page to connect to the Northwind database by...
2
by: Thomas Cameron | last post by:
Hello all, I have written an application in Visual Basic .Net 2003 which allows staff members to enable user accounts within a specific group in our Active Directory. However, as an added piece I...
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...
0
by: Jonathan Wood | last post by:
I seem to be having errors creating and accessing an SQL database. Unfortunatley, I am brand new to SQL setup and administration issues so this really is not my area of expertise. I know I had...
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"...
3
by: Saqib Ali | last post by:
is there a way to enforce password history verification when using Directory.Entry.Invoke("SetPassword", newPasswdStr)??? saqib http://www.full-disk-encryption.net
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...
3
by: Charlotte | last post by:
Hello, info: I'me a rookie with IIS I have on a WinXP Pro the IIS installed, so I can test some pages before uploading to the hostserver online on the hostserver is a possibility (with the...
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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...

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.