How do you get powershell to ignore the ^ in a security group name? (caret) RRS feed

  • Question

  • I am trying to extract member info from security groups that have ^ carets, in the security group name

    For example a group named sec^group^name

    At the most basic

    Get-AdGroupMember sec^group^name 

    Will not return result.. Get-AdGroupMember "sec^group^name" will not return results either

    How do you get powershell to ignore the ^ ?

    Wednesday, October 17, 2018 8:50 PM

All replies

  • Try escaping the carat character:

    Or try putting the string into a variable and then use the variable instead of a string literal in the Get-AdGroupMember.

    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    Wednesday, October 17, 2018 9:00 PM
  • Is "sec^group^name" the sAMAccountName of the group? If it is the Name of the group (the RDN) it will not work (unless it matches the sAMAccountName).

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Wednesday, October 17, 2018 10:07 PM
  • Hi K,

    Thanks for your question.

     The acceptable values for "-Identity" parameter are:

    1. A distinguished name.
    2. A GUID (objectGUID).
    3. A security identifier (objectSid).
    4. A Security Account Manager account name (sAMAccountName).

    It can run success in my environment.

    Best Regards,


    Just do it.

    Thursday, October 18, 2018 3:02 AM