Link to home
Start Free TrialLog in
Avatar of ivan rosa
ivan rosaFlag for United States of America

asked on

Active Directory: Name to NTID

Hello Folks,
I have a list of users first name last name ( john doe )...is there any command that will retrieve me their ntid?

thanks for looking
Avatar of Sean
Sean
Flag of United States of America image

Are you wanting to import the csv and get the user's ID back? Powershell will get you the information you want just need to know what you are trying to accomplish and how your csv is formatted exactly.

assuming you only have first name and last name it would be something like this.

$filepath = "c:\scripts\users.csv"
$users = Import-CSV $filepath -Header firstname,lastname

Foreach ($user in $users) {
Get-ADUser -Filter {givenname -eq "$_.firstname" -and surname -eq "$_.lastname"} -properties *| fl name,UserPrincipalName

}

Easily can be adjusted to any properties you are looking to get.
ASKER CERTIFIED SOLUTION
Avatar of ivan rosa
ivan rosa
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ivan rosa

ASKER

this link will satisfy my question