I want to get only OU
of specific user.
Example the command should display what OU
user JOHN
belongs to:
USERNAME = OU_NAME
active-directorypowershell
I want to get only OU
of specific user.
Example the command should display what OU
user JOHN
belongs to:
USERNAME = OU_NAME
Best Answer
If you don't have the AD-Module installed, you can also use this. I found this very useful when I ran scripts where I needed AD-Information, but didn't have the AD-Module installed. :
Now
$WorkOU
would return a string like thisLDAP://OU=userou,OU=userou2,DC=internal,DC=domain,DC=com
which you can filter any way you want.