Hi,
I have been trying to figure out how to split (or delimit) the [Identity] or [CN] variable of a active directory user object at a certain point but then only return the objects before that point.
This is problematic because a CN contains the same delimiter, "/". So essentially I'm trying to delimit on a specific occurrence of a character.
For example :
$string="contoso.local/Country/City/Office/Resources/Users/User1"
I want to return everything before the 4th "/" :
"contoso.local/Country/City/Office"
I can use 'split' to return "/Resources/Users/User1" but I can't figure out how to retrieve the data preceding.
Can anyone clue me in please??
Thanks