I have a code which reads names and exports the username from ADUC.
I wanted to create a simple condition (if statement) into my code to change username to “Not Found” if the full name has wrong spelling or that name does not exist in my ADUC.
If you have a proper CSV file as input you should use the proper cmdlet for the import. Of course you will have to adjust the code to fit you precondition. You may post some example lines of your CSV file (formatted as code as well, please).