PowerShell:
Import-Module ActiveDirectory
(Get-ADUser userName –Properties MemberOf | Select-Object MemberOf).MemberOf
Notepad++:
Three Find and Replace – ,CN=.* ,OU=.* CN= with nothing
It searches for [text] followed by any character (.) any number of times (*), effectively “any sequence of characters”, ending at the line break.