The need :

You need to export your Active Directory users and need to get an “OU” parameter for each user to be able to migrate user, create reports or whatsoever. For this you need a powershell result with the samaccountname and OU of the user. This simple script will allow you to parse this information in one powershell object you can reuse in you scripts.


The code :


The result