I have a bunch of strings that are DN\'s of groups from AD. I need to pull out the Common Name. An example string is \"CN=Group Name I Want,OU=Group Container,DC=corp,DC=tes
$s = "CN=Hall\, Jeremy,OU=Group Container,DC=corp,DC=test,DC=local"
$s1 = ($s -split ",*..=")[1]
$s1
This works for me - however, I have a \, left in name output. (I'm pulling the manager property from the get-aduser function and it prints the distinguishedName. Hall\, Jeremy is one example of what I'm left with.
Anyone want to take a stab?