Generate list of default email addresses from AD

From Michael's Information Zone
Jump to navigation Jump to search
Get-ADUser -filter {enabled -eq "True"} -Properties * | where {$_.office -match "[a-z]"} | select name,@{Name="Address";Expression={$_ | select -ExpandProperty proxyaddresses | foreach {if ($_ -cmatch "SMTP:"){$_ -replace 'SMTP:',""}}}} | sort name

name                 Address
----                 -------
John Doe        johndoe@johndoe.com