Consulting

Results 1 to 2 of 2

Thread: LogParser and ADSI - Example Code

  1. #1
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location

    LogParser and ADSI - Example Code

    Have an Active Directory then check this out (you must have Logparser 2.2 installed, but it is free from Microsoft). It outputs to the LogParser datagrid, but you can easily chose another output format like .csv or choose COM output and move the data directly into a db table or spreadsheet.

    [vba]
    Sub getmembers()
    Dim oLog, oInput, oOut, cSQL
    Set oLog = CreateObject("MSUtil.LogQuery")
    oLog.maxParseErrors = 100
    Set oInput = CreateObject("MSUtil.LogQuery.ADSInputFormat.1")
    oInput.ObjClass = "user"
    Set oOut = CreateObject("MSUtil.LogQuery.DataGridOutputFormat.1")
    cServer = "myServer"
    cDC = "myDomain"
    cDC1 = "com" 'or net
    cSQL = "SELECT cn,memberOF INTO DATAGRID FROM LDAP://" & cServer & "/DC=" & cDC & ",DC=" & cDC1
    oLog.ExecuteBatch cSQL, oInput, oOut
    Set oOut = Nothing
    Set oInput = Nothing
    Set oLog = Nothing
    End Sub
    [/vba]

    Stan

  2. #2
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    bummer no Active Directory people out there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •