Newbie looking for some help...Get-ADComputer

How do you know who gets the file. So if you prompted with a read-host, how would you know what to type. I guess what I need to understand is the business rules you are trying to implement here. If you want to prompt the user with a Read-Host, it is very easy to do. Whatever the user enters is returned as a string and it can be assigned to a variable. Get-Help Read-Host

I need to run the Get-ADComputer query for 25 OUs for different countries and outfile a .txt file for computers with no descriptions for each OU. This I’ve done with the help here with the for-each loop.

After the 25 files are outputted then I need to email the 25 attachments to different people such that USA.txt goes to John Smith, UK.txt goes to Jane Smith, etc. I wasn’t sure how this can be done except manually coding them in different MAILTO with each attachment so was thinking if READ HOST can identify if John Smith enters his email then it can somehow grab the correct attachment.

there isn’t any way around it, you have to store “somewhere” whom gets what attatchment, if thats in code via hash-table, a database somewhere, or a simple csv file.

All a read-host will do is take user input and store the test string as variable.

if you won’t be changing whom gets what file ever, then you can do it in code, if you need to make changes frequently, you need to store that association elsewhere.