PS noob needs workaround for get-adprincipalgroupmembership issue

Welcome Forums General PowerShell Q&A PS noob needs workaround for get-adprincipalgroupmembership issue

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
1 year, 5 months ago.

  • Author
    Posts
  • #71794

    Participant
    Points: 1
    Rank: Member

    Hi all,

    In our AD, unfortunately we have several groups that contain a '/' in their names. When running the get-adprincipalgroupmembership cmdlet this causes an error if a user is a member of such a group. Is there a way to get all groups displayed that do not have the '/' character in their names?

    Here's the cmdlet I've been using:

    Get-ADPrincipalGroupMembership username | select name | sort name

    Thanks in advance.

  • #71795

    Keymaster
    Points: 1,644
    Helping HandTeam Member
    Rank: Community Hero
    • #71804

      Participant
      Points: 1
      Rank: Member

      Yes, I'm aware. But changing the group names is not an option right now, so that's why I was wondering if and how to workaround it.

    • #71833

      Participant
      Points: 22
      Rank: Member

      Could you get around the issue by searching on a particular user instead of a Group?

      Get-ADUser -Identity SomeUsername -Properties memberOf | Select-Object -ExpandProperty memberOf

      It would take a bit more work and some logic to filter for a particular group(s), but might get you where you need to be.

    • #71851

      Participant
      Points: 1
      Rank: Member

      Yes this is what I need, thanks. Now all I need is to format it nicely.

The topic ‘PS noob needs workaround for get-adprincipalgroupmembership issue’ is closed to new replies.