When writing powershell scritps that need to deal with Active Directory you'll, eventually, have to work with distinguishedNames. Finding the domain or the OU in which the object is useful in most situation.
Here's a regular expression to use against an object distinguishedName that return a $Matches object containing:
- commonName of the object (CN=...)
- name of the object
- path of the object
- domain part of the path
^(?:(?<cn>CN=(?<name>[^,]*)),)?(?:(?<path>(?:(?:CN|OU)=[^,]+,?)+),)?(?<domain>(?:DC=[^,]+,?)+)$
You can test it on regexr.com at this url: https://regexr.com/3l4au
Cheers
Congratulations @esoso! You have received a personal award!
Click on the badge to view your Board of Honor.
Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - France vs Belgium
Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @esoso! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi my name is Jerome. I am giving away 0.500 SBD for signing up to this ICO
After you have completed you will recieve your reward
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit