Rui Qiu's Tech Blog
← Back to all posts

June 22, 2015

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

}