Extract All User Properties from Active Directory to CSV


Below script allows you to use CSV to extract profile properties from active directory and then export to CSV.

Import-Module ActiveDirectory -ErrorAction SilentlyContinue
$Data = Import-Csv -Path “C:\Scripts\NoSPProfileAccounts.csv”
$Users = $null
$Users = @();
if($Data)
{
    $Data | ForEach-Object { Write-Host $_.Account; $User = Get-ADUser -properties * -Filter “UserPrincipalName -eq ‘$($_.Account)'”;$Users +=$User;}
}
$Users | Export-Csv -NoTypeInformation -Path “C:\Scripts\Users.csv”
$Users | Out-GridView