How to get single quotes around a variable property?

This topic contains 5 replies, has 3 voices, and was last updated by  Olaf Soyk 5 months, 3 weeks ago.

  • Author
    Posts
  • #69753

    Hi

    I have a newbie problem with Exchange Management Shell
    I am trying script a way to get a list of members from a Address List. I first assign the address list to a variable.

    $al = Get-AddressList -Identity "all rooms"

    I can get the LDAP path by doing this

    $AL.DistringuishedName

    My problem is putting singel quotes around the LDAP path, so i can do somthing like this

    Get-Recipient -filter {addresslistmembership -eq '$AL.DistringuishedName'}

  • #69754

    Olaf Soyk
    Participant

    you can use subexpressions for this

    "'$($AL.DistringuishedName)'"
    • #69769

      Thanks

      That does put single quotes around the LDAP path, but

      Get-Recipient -filter {addresslistmembership -eq "'$($al.DistinguishedName)'"}

      still don't give any output

  • #69774

    Olaf Soyk
    Participant

    oooops ... that's what we call "Flüchtigkeitsfehler" 😉
    Try it that way:

    "$($AL.DistringuishedName)"

    (without the single quotes)
    Edit: I think it should work even without the quotes

  • #69778

    Rob Simmers
    Participant

    I was expecting something more....expletive.. 🙂

    https://translate.google.com/#auto/en/Fl%C3%BCchtigkeitsfehler

    • #69781

      Olaf Soyk
      Participant

      Hey hey ... I am a nice guy! 😛

You must be logged in to reply to this topic.