Thanks Ken!

I am a complete novice when it comes to VB but the information provided
helped me refine my googlefu. I stumbled upon the following which worked
perfectly:

http://www.activedir.org/Articles/tabid/54/articleType/ArticleView/articleId/14/Default.aspx
#

  Option Explicit
Dim objCommand, objConnection, strBase, strFilter, strAttributes, objUser
Dim strQuery, objRecordset, strdistinguishedName, strTSPath, strCN
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
'...set the base DN
strBase = "<LDAP://DC=MYCO,DC=COM <ldap://DC=MYCO,DC=COM/>>"
strFilter = "(&(objectCategory=person)(objectClass=user))"
strAttributes = "sAMAccountName,cn,distinguishedName"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute

Do Until objRecordSet.EOF
  strdistinguishedName = objRecordSet.Fields("distinguishedName").Value
  Set objUser = GetObject("LDAP://" & strdistinguishedName)
  On error resume next
  Wscript.Echo objUser.cn & "," & objUser.sAMAccountName _
  & "," & objUser.TerminalServicesProfilePath & "," & objUser.profilePath _
  & "," & objUser.homeDirectory & "," &objUser.ScriptPath
  objRecordSet.MoveNext
Loop


objConnection.Close
To use the script to write out to a CSV file, simply use the following
command line (assumes you have saved the script as profiledump.csv):

cscript profiledump.vbs > profiledump.csv

- Sean

On Wed, Oct 21, 2009 at 2:14 PM, KenM <[email protected]> wrote:

> you can do this pretty easy in VBScript
>
>  Set objUser = GetObject(LDAP://DNofUser)
>  WScript.Echo Objuser.TerminalServicesProfilePath
>
> And if you want all users you can search AD using ADO.
>
>
>
>
>
>
> On Wed, Oct 21, 2009 at 6:06 PM, Sean Martin <[email protected]>wrote:
>
>> I'm sure this has been asked in the past, but I couldn't find anything in
>> my archives.
>>
>> Is there a way to query AD to find the value of the terminal service
>> roaming profile path for each user? It seems the data is stored as a binary
>> log file so traditional ldap tools won't give me the data I need.
>>
>> I recently migrated users to new roaming profiles users using tscmd. Now I
>> would like to find out if there are any users that were missed.
>>
>> - Sean
>>
>>
>>
>>
>>
>>
>
>
>
>
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to