Find AD users using Profile Paths (roaming profiles)

Posted by robd on May 08, 2014
powershell

So today due to a server migration I needed a list of all the users who have roaming profiles, found this useful Powershell script:

Please note you need to ammed this line of code to suite your site: “OU=VI2,OU=Students,OU=Users,OU=Monmouth School,DC=Monmouth,DC=local”

Get-ChildItem -Filter "(&(objectclass=user)(objectcategory=user)(profilepath=*))" `
 -Path Ad:\"OU=DEPARTMENT,OU=Users,OU=SITE,DC=DOMAIN,DC=local" -Recurse |             
foreach {             
 $user = [adsi]"LDAP://$($_.DistinguishedName)"            
 $user | select @{N="Name"; E={$_.name}},             
 @{N="DistinguishedName"; E={$_.distinguishedname}},            
 @{N="ProfilePath"; E={$_.profilepath}}            
} | export-csv txt.csv  

Tags: , , , , , , ,

1 Comment to Find AD users using Profile Paths (roaming profiles)

  • To ensure consistency it is often desirable to run a script periodically to confirm all users are setup as expected. The following powershell script can help with obtaining ProfilePath, HomeDirectory and HomeDrive.

    In an elevated (run as Administrator) powershell window run the following:
    Get-ADUser -Filter ‘enabled -eq $true’ -Properties ProfilePath, HomeDirectory, HomeDrive | Select Name, SamAccountName, ProfilePath, HomeDirectory, HomeDrive

    To export the list into a more convenient format such as CSV simply run the following:
    Get-ADUser -Filter ‘enabled -eq $true’ -Properties ProfilePath, HomeDirectory, HomeDrive | Select Name, SamAccountName, ProfilePath, HomeDirectory, HomeDrive | Export-Csv -path “c:\temp\userlist.csv”

    The above can be tweaked to get more properties as needed.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.