Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / September 2006

Tip: Looking for answers? Try searching our database.

Active Directory User Creation Issues

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
timburda@hotmail.com - 14 Sep 2006 17:33 GMT
I know I'm just another in a long list of people who have active
directory developers who have problems, but I'm going to post anyway:

I add a user to the container:

"CN=Users,DC=my,DC=domain,DC=com"

I set the following properties:

oDE = GetDirectoryObject(LDAPDomain);
oDEC = oDE.Children.Add("CN=" + user.UserName, "User");

oDEC.Properties["samAccountName"].Add(user.UserName);
oDEC.Properties["userPrincipalName"].Add(user.UserName);
oDEC.Properties["givenName"].Add(user.FirstName);
oDEC.Properties["sn"].Add(user.LastName);
oDEC.Properties["displayName"].Add(user.FirstName + " " +
user.LastName);
oDEC.Properties["accountExpires"].Add(-1)

I then commit the changes and the user saves fine, with the exception
that they are disabled

I then try to modify the user:

oDEC.Properties["userAccountControl"].Value = 512;

when I commit the changes, I get the dreaded error:

The server is unwilling to process the request.

Can somebody tell me what that error means? Any thoughts on how to
debug or toubleshoot this?

Also, I tried to set the accountExpires to various long integers, but
my result never changes. This is supposed to be some goofy number of
100 nanoseconds (who thought this was a good idea?) since 1/1/1600. -1
will make the account never expire, but other values (even thought I
use a 64 bit integer) don't seem to work.

Any help related to any of this is appreciated!

Thanks -

Tim Burda
Joe Kaplan - 14 Sep 2006 20:08 GMT
Typically, if AD has a password policy in place, you can't enable a user
until you've set a password.  That's probably what's happening here.

I discuss all this stuff in gory detail in ch 10 of my book.  That chapter
is provided as a free download by the publisher, and you can find it at the
link in my sig.  My guess is that a quick read of it will save you a ton of
time.  Our code samples are all on the site as well for free.

Joe K.

Signature

Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--

>I know I'm just another in a long list of people who have active
> directory developers who have problems, but I'm going to post anyway:
[quoted text clipped - 41 lines]
>
> Tim Burda
timburda@hotmail.com - 14 Sep 2006 20:40 GMT
Joe -

I actually solved my problem.

How? I bought your book! Given my level of frustration, it was well
worth the price.

My luck - you mentioned the chapter I needed is available for free.

Actually, the books looks like it will be really useful for several
other topics.

Thanks -

Tim

> Typically, if AD has a password policy in place, you can't enable a user
> until you've set a password.  That's probably what's happening here.
[quoted text clipped - 56 lines]
> >
> > Tim Burda
Joe Kaplan - 14 Sep 2006 21:47 GMT
We picked that particular chapter for the freebie because it is so practical
and really covers what most people "do" when changing AD data.  However, a
lot of people who are newbies struggle with it because we assume that you've
already read the all-important ch 3, 4 and 6 and actually know how to
connect and search.  You end up in a "run before you can walk" scenario.

I'm truly hopeful that you find the book useful and worth your money.

Joe K.

Signature

Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--

> Joe -
>
[quoted text clipped - 76 lines]
>> >
>> > Tim Burda

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.