Copy and paste the following into a powershell script. Be sure to run this on a 2008R2 DC or equiv, or else the RDS profile is not available
Import-Module ActiveDirectory
Get-ChildItem -Filter “(&(objectclass=user)(objectcategory=user))” -Path ad:\”CN=Users,DC=horodc,DC=local” -Recurse |
foreach {
$user = [adsi]”LDAP://$($_.DistinguishedName)”
$user | select @{N=”Name”; E={$_.name}},
@{N=”ProfilePath”; E={$_.profilepath}},
@{N=”RDSProfilePath”; E={$_.psbase.invokeget(“TerminalServicesProfilePath”)}}
} | export-csv c:\test.csv