Powershell – Dump AD users to CSV

Dump all active users in a particular AD group to a CSV, with headers:

<code>get-aduser -filter * -properties * | where {$_.memberof -like “*ADgroupgoeshere*” -and $_.enabled -eq $true} | select @{name=”emailAddress”;expression={$($_.emailAddress)}},@{name=”firstName”;expression={$($_.givenname)}},@{name=”lastName”;expression={$($_.surname)}} | export-csv c:\scripts\users.csv -notypeinformation</code>

Leave a Reply

Your email address will not be published. Required fields are marked *