querie homefolder

Discussion in 'Active Directory' started by Johan deheugden, Jun 23, 2008.

  1. i am looking for a querie that exports the homefolders patch(unc if possible)
    from several user into a textfile. can someone help me or is there a script
    available what i ca use? thank you.
    Johan deheugden, Jun 23, 2008
    1. Advertisements

  2. Johan deheugden

    DP133091 Guest

    Here is a script that will show username and home path.

    On Error Resume Next


    Set objConnection = CreateObject("ADODB.Connection")
    Set objCommand = CreateObject("ADODB.Command")
    objConnection.Provider = "ADsDSOObject"
    objConnection.Open "Active Directory Provider"
    Set objCommand.ActiveConnection = objConnection

    objCommand.Properties("Page Size") = 1000
    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

    objCommand.CommandText = _
    "SELECT Name, homeDirectory FROM 'LDAP://dc=yourdomain,dc=comornet'
    WHERE objectClass='user' AND homeDirectory='*'"
    Set objRecordSet = objCommand.Execute

    Do Until objRecordSet.EOF
    Wscript.Echo objRecordSet.Fields("Name").Value
    Wscript.Echo objRecordSet.Fields("homeDirectory").Value
    DP133091, Jun 23, 2008
    1. Advertisements

  3. great,thanks

    Johan deheugden, Jun 24, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.