Get Samaccountname from DisplayName using powershell active Directory

Get Samaccountname from DisplayName using powershell active Directory

$names = get-content “C:\Users\vbokka\Desktop\user.txt”
foreach ($name in $names) {Get-ADUser -filter { DisplayName -eq $name } -server “corp.bydeluxe.com”| Select name,samAccountName}

Leave a Reply

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