Re: AD and VB.Net

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Chriss3 [MVP] (noSpamHere_at_chrisse.se)
Date: 08/30/04


Date: Mon, 30 Aug 2004 17:35:34 +0200

Bob the DN is wrong. with other words the LDAP source are wrong. I give you
an example for the DN to the administrator account

LDAP://CN=Administrator,CN=Users,DC=thelancairccompany,DC=com

More Info:

AD Schema DN Syntax:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/s_object_ds_dn.asp

Choosing a AS Syntax
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/choosing_a_syntax.asp

-- 
Regards
Christoffer Andersson
Microsoft MVP - Directory Services
No email replies please - reply in the newsgroup
------------------------------------------------
http://www.chrisse.se - Active Directory Tips
"Bob" <anonymous@discussions.microsoft.com> skrev i meddelandet
news:093001c48ea4$e7f6d2f0$a401280a@phx.gbl...
> I am having trouble getting some VB.Net code to add a
> user to that AD.  I'm getting a very odd error that I
> can't seem to get rid of and the cause is not making
> itself very clear.  Not to mention the fact that finding
> info on this error is rather tough.
>
> The error I get when try to add the user is:
>
> "An invalid dn syntax has been specified."
>
> It says it is taking place on the line of code in which I
> try to set the password for the new user.
>
> Here is my code as it stands now:
>
>             Dim de As New DirectoryEntry
> ("LDAP://CN=Users,DC=thelancaircompany,DC=com", "tlc\admin
> istrator", "Password", AuthenticationTypes.Encryption)
>             Dim user As DirectoryEntry = de.Children.Add
> ("testa", "user")
>             Dim pass As New Object()
>
>             pass = "NewPassword"
>
>             user.Properties("SAMAccountName").Value
> = "testa"
>             user.Properties("userPrincipalName").Value
> = "testa"
>             user.Properties("scriptpath").Value
> = "start.bat"
>             user.Properties("givenname").Value = "test"
>             user.Properties("sn").Value = "test"
>             user.Properties("displayname").Value = "test
> a. test"
>             user.Properties("department").Value
> = "Accounting"
>             user.Properties("initials").Value = "A"
>             user.Properties("profilepath").Value
> = "\\condor\files\users\profiles\testa" '& AD1.UserName
>             user.Invoke("SetPassword", pass)
>
>             user.CommitChanges()
>
> Any help would be greatly appreciated.
>
> TIA


Relevant Pages

  • Re: Script logon
    ... MVP - Directory Services ... MCTS, MCT, MCSE, MCSA, MCP, Security +, BS CSci ... This might be what you remember (I don't know the syntax). ... a product called XiXtart could test group membership. ...
    (microsoft.public.windows.server.active_directory)
  • Re: VB6+ Article in VSM by Bill McCarthy
    ... They would all be nice to have Bob, but the case being made is really one of ... Significant enhancements to VB6 might be viewed as "competition" for VB.Net, ... whole heap of compiler help to weed-out syntax or functionality that will ...
    (microsoft.public.vb.general.discussion)
  • Re: Script logon
    ... MVP Directory Services ... MVP - Directory Services ... This might be what you remember (I don't know the syntax). ... a product called XiXtart could test group membership. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Lost administrator password
    ... Thank you all for your responses. ... There were Bob, Guest and Administrator. ... have added a password to the administrator account. ... I reboot into regular win xp home. ...
    (microsoft.public.windowsxp.newusers)
  • Re: Interview questions
    ... Bob Grabbe ... >>>> Christoffer Andersson ... >>>> Microsoft MVP - Directory Services ... >>>> No email replies please - reply in the newsgroup ...
    (microsoft.public.windows.server.active_directory)