Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

how to get the master OU for every user and populate it in ExtensionAttribute8

$
0
0

Hello All,

I am working on a script to add the master OU name only to the users extensionAttribute8 but i failed to do this.

e.g. I have these users distinguishedName

1- CN=user1,OU=10289,OU=Students,DC=mydomain,DC=com

2- CN=user2,OU=10335,OU=Staff,DC=mydomain,DC=com

3- CN=user3,OU=Teachers,DC=mydomain,DC=com

so how can I have the OU after DC=mydomain,DC=com (from right)  whatever the user exist on any child OU

for example i need for the first user1 to add Student word as a value to extensionattribute8

and for  user2 to add staff word as a value to extensionattribute8

and for  user3 to add Teachers word as a value to extensionattribute8

thanks a lot in advance


Viewing all articles
Browse latest Browse all 10624

Trending Articles