"Christmas - the time to fix the computers of your loved ones" « Lord Wyrm

user in ad importieren

zork_sqc 23.09.2004 - 18:29 3206 1
Posts

zork_sqc

Little Overclocker
Registered: Jul 2004
Location: LB
Posts: 55
hat irgendwer ein tool, mit dem man benutzname und kennwort von einer ms access datenbank in ein active diretory importieren kann.
mfg

void0

Little Overclocker
Avatar
Registered: Dec 2002
Location: at/wien/4 | ch@I..
Posts: 58
Ich hatte mir mal ein Tool geschrieben um sequentiell User im AD anzulegen. Evtl. kannst du dir ja mit der VB6 Funktion hier selber weiterhelfen:

Code:
Private Function createUser(LDAPstr As String, thisUser As String)
On Error GoTo cu_err

    Dim ou As IADsContainer, usr As IADsUser
    Set ou = GetObject(LDAPstr)

    ' Create User
    Set usr = ou.Create("user", "CN=User " & thisUser)
    
    MkDir ValidatePath(ConfigUserHomeDirLocal) & thisUser
    usr.Put "samAccountName", thisUser
    usr.Put "userPrincipalName", thisUser & "@" & ConfigUserDomain
    usr.Put "EMailAddress", thisUser & "@" & ConfigUserEMAILDomain
    usr.Put "HomeDirectory", ValidatePath(ConfigUserHomeDirUNC) & thisUser
    usr.Put "MaxStorage", ConfigUserMaxStorage
    usr.SetInfo
    usr.Put "FullName", ConfigUserFullName
    usr.Put "LoginScript", ConfigUserLoginScript
    
    Set usr = ou.GetObject("user", "CN=User " & thisUser)
    Set usr = ou.GetObject("user", "CN=User " & thisUser)
    usr.Put "userPrincipalName", thisUser & "@" & ConfigUserDomain
    Set usr = ou.GetObject("user", "CN=User " & thisUser)
    
    ' Password
    If ConfigUserUniquePasswords = True Then
        Dim myPass As String
        myPass = GenPass
        usr.SetPassword myPass
        frmLog.txtLog.Text = frmLog.txtLog.Text & vbCrLf & "Pass: " & myPass
        
        If ConfigLog = True Then
            Open ConfigLogFile For Append As #1
                Print #1, thisUser & ", " & myPass
            Close #1
        End If
    End If
    
    ' Enable Account ....
    Set usr = ou.GetObject("user", "CN=User " & thisUser)
    usr.AccountDisabled = False
    usr.SetInfo
    
    
    ' Flag Homedirectory ....
    AddUserToSecurityForFSO ValidatePath(ConfigUserHomeDirLocal) & thisUser, thisUser

    
cu_exit:
    Exit Function
    
cu_err:
    frmLog.txtLog.Text = frmLog.txtLog.Text & vbCrLf & "ERROR: CreateUser: " & Err.Number & " - " & Err.Description
    Resume Next
End Function
Kontakt | Unser Forum | Über overclockers.at | Impressum | Datenschutz