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
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.