Ok, I often have to extract and attribute from AD that returns objects in a DN format. Then I have to clean it up to only get the CN of the object and i re-create what I do every time so I figured I’d post it here so I don’t forget 🙂
So you have a list of DN’s, here’s how to clean it up.
- Paste the list into Excel
- Do a search/replace on CN= and replace with blank
- Punch this formula into an adjacent cell and expand down, "=LEFT(A1,(FIND(",",A1)-1))". This will return all the characters to the left of the first ","
- You now have a list of only the CN’s from the full DN
I hope this helps 🙂