Microsoft Access

Verzeichnisrechte einlesen

25. 02. 2013

Mit folgendem Skript kann man in Microsoft Access die Verzeichnisrechte auslesen und in eine Tabelle speichern:

Sub VerzAuslesen()
    Dim db As DAO.Database ' Verweis "DAO 3.6"
    Dim sql As String
    Dim objComputer, objUser
 
    Set db = CurrentDb
    Set objComputer = GetObject("WinNT://" & "Ordner")
 
    For Each objUser In objComputer
        sql = "INSERT INTO TblUser (Name, Fullname, AccountDisabled, Profile) " _
            & "SELECT '" & objUser.name & "' AS Name, '" & objUser.FullName & "' AS Fullname, '" & objUser.AccountDisabled & "' AS AccountDisabled, " _
                   & "'" & objUser.primaryGroupID & "' AS Profile;"
        db.Execute sql
    Next
End Sub

image_print
1 Stern2 Sterne3 Sterne4 Sterne5 Sterne
Loading...

Author

Manuel