How to display just the group name of groups user is member of in powershell
问题 So I have the following script but it lists the full name of the AD group. (e.g. CN=GroupName,OU=OUName,DC=DomainName,DC=com ) How do I specify only the group's name, so that it lists only the name itself. The part after CN= . I tried $group.Name but no such luck. Import-Module ActiveDirectory $userlist = Get-Content "C:\Scripts\US_User_List.txt" foreach ($username in $userlist) { $grplist = (Get-ADUser $username –Properties MemberOf | Select-Object MemberOf).MemberOf foreach ($group in