Can anyone help me with this. I need to derive a City name from the "managedby" attribute in Active Directory which looks like this:
CN=Marley\, Bob,OU=Users,OU=PARIS,DC=Domain,DC=com
So I need to take everything out and be left with "PARIS"
I really don't know enough about Regex but assume its going to involve using -replace in some way. I have tried following some examples on the web but I just get lost. I can remove all special characters using:
'CN=Marley\, Bob,OU=Users,OU=PARIS,DC=Domain,DC=com' -replace '[\W]', ''
But I have no idea how to clean that up further.
Any help would be greatly appreciated