Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Trying to run AD report from list of users

$
0
0

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-ModuleActiveDirectory
$users=Import-csvC:\users.txt
Get-ADUser$users-PropertiesTitle,Manager|selectTitle,Manager

 

 

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

Get-ADUser test.user-PropertiesTitle,Manager|selectTitle,Manager
Title           Manager
-----           -------
IT TestUser    fulldistinguishedLDAPname

 

 

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

Get-ADUsertest.user-PropertiesTitle,Manager|%{(Get-AdUser$_.Manager-PropertiesName).Name}

IT Test Manager

 

 

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


Viewing all articles
Browse latest Browse all 8583

Trending Articles