Samuel
Samuel

Reputation: 1

Creating new active directory account from an asp.net webpage

I'm 14 and I am really stuck. I wish to have an ASP.NET webpage that will enable users to create a new account in an organizational container. I have seen many pages on this but I just keep getting stuck.

Also, if this is possible, once the user has signed up would it be possible to run a script to enable the user for Office Communications Server 2007, or will I have to set the script as a cron job every 2 minutes?

Thanks in advance for your help.

Upvotes: 0

Views: 1326

Answers (1)

CaptainB
CaptainB

Reputation: 11

Here is how I do it in a classic asp page:

Set objContainer = GetObject("LDAP://OU=OUtoPut,DC=YOUR,DC=ORG")
Set objUser = objContainer.Create("User", "CN=" & strCN)

objUser.sAMAccountName = strCN
objUser.givenName = strFName
objUser.sn = strLName
objUser.FullName = strCN
objUser.displayName = strCN
objUser.UserPrincipalName = strCN & "@your.org"
objUser.SetInfo
objUser.SetPassword strPass
objUser.pwdLastSet = 0
objUser.SetInfo
objUser.AccountDisabled = False
objUser.SetInfo

probably a little overdone toward the end with the setinfos, but it works.

Upvotes: 1

Related Questions