Trying to run AD report from list of users

by Apr 11, 2014

I have a list of users that I need to pull information from AD and then output to a file. I am having trouble with a couple of things.

1. How do I import this list of users from a txt file and then cycle through this list. This is what I have, but I can't get the $users variable to work properly.

Import-Module ActiveDirectory
$users = Import-csv C:users.txt
Get-ADUser $users Properties Title,Manager | select Title,Manager

 

 

If I just run just this line, like so it outputs this information.

Get-ADUser test.user Properties Title,Manager | select Title,Manager
Title           Manager
—–           ——-
IT Test User    full distinguished LDAP name

 

 

I figured out how to output only the name of the manager, but then I loose the title.

Get-ADUser test.user Properties Title,Manager | %{(Get-AdUser $_.Manager Properties Name).Name}

IT Test Manager

 

 

How do I combined all of this to make a functional script? Thank you!