I know this sounds very simple, but I think what I need is more complex than my Title makes it appear. At least it is to me! I tried to find the answer on my own but don't know PS well enough to craft what I need myself.
I need to search AD for all Users who have specific text in a specific field. If possible I'd like to limit the search to a particular container but I can deal if that's not possible.
In plain English, I want to search the QBUsers OU for all Users whose TsHomeDirectory field contains the text %username%. The results should be saved to a txt or CSV file, I'm not picky.
This isn't truly an exact match search; the possible values in that field might be like\\dcmcvctshome01\Homedir\JSMITH. The ones I want to identify would be like\\dcmcvctshome01\Homedir\%USERNAME%.