Active Directory: Name to NTID

ivan rosa
ivan rosa used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
SeanSystem Engineer

Commented:
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.
thanks for the quick response, although when i run the script, it only jumped into another line of prompt, didn't give me any error nor result...

i did however found what i am looking for here:
dsquery user -name "john doe"|dsget user -samid -email -display -dept -title

Open in new window

Author

Commented:
this link will satisfy my question

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial