Find a list of SAMAccountNames from a list of DisplayNames
Tried a bunch and this is the only one that worked for me.
$names = get-content C:\Users\jsmith\Documents\App_Users.csv
foreach ($name in $names) {Get-ADUser -filter { DisplayName -eq $name } | Select name,samAccountName | Export-Csv C:\Users\jsmith\Documents\App_Users_results.csv -NoTypeInformation -Append }
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment