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

More on BREAK

$
0
0

ok, this goes back to my last post.  I have 64 .TXT files.  Each .TXT file has samaccountnames inside.  There could be 5 names or 75 names in each .TXT file, each one is different.   

 

$read=get-childitem-name"c:\temp"
$read
$user1=foreach ($namein$read) {Get-Content"c:\temp\$name" | get-aduser-Properties* | Select-Object GivenName, Surname, department, Office, Description, Title}
$user1

 

that code works and and it gets the information I need.  But it gives me all the names together.  I need to create a new .TXT for each list of names.  Example:

 

File1.txt has 10 SamAccountNames inside.   I need to read Files1.txt, get the ad information I need, and then write a new file1A.txt with the ad information I've gathered.

 

 

But how do I create a new .TXT file with this information for each .TXT file I have?

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles