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 = @();
    $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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s