How to get single quotes around a variable property?


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


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

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

you can use subexpressions for this



That does put single quotes around the LDAP path, but

Get-Recipient -filter {addresslistmembership -eq “‘$($al.DistinguishedName)’”}

still don’t give any output

oooops … that’s what we call “Flüchtigkeitsfehler” :wink:
Try it that way:

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

I was expecting something more…expletive… :slight_smile:

Hey hey … I am a nice guy! :stuck_out_tongue: