Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

getting samaccountname from an e-mail address

$
0
0

I need a scipt to get samaccountname from an e-mail address.

I have the script for getting samaccountname from display name

$mbxlist = Get-Content E:\Sid\Users.txt
ForEach ($mbx in $mbxList ) {
Get-ADUser -Filter "Name -eq '$mbx'" | Select -Property SamAccountName
}

What changes i need to make in this script to use an e-mail address instead of display name

The text file Users.txt contains display names. do i need to replace the Contents of the text files with e-mail addresses?

Please advise


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>