Powershell Script to Find Email Address from Username in a Text File

Here is the simple powershell script to grab email address from AD. In a text file,just put username there.

# Q's email script

$names=get-content c:\pc.txt

foreach ($name in $names) {

Get-ADUser $name -Properties mail | select mail

}