Bug in PowerShell for Exchange Online

PFS IT 21 Reputation points
2021-09-13T16:20:28.627+00:00

Hi

Just a quick question; Is this maybe a bug?

131685-unbenannt.png

With the -Filter parameter, no matching group is found but with "Where" the desired group is found.

Microsoft 365 and Office | Office Online Server
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

Answer accepted by question author
Andreas Baumgarten 133.1K Reputation points MVP Volunteer Moderator
2021-09-13T17:25:17.123+00:00

Hi @PFS IT ,

please try this (not tested):

Get-DistributionGroup -Filter "Name -eq '$GroupName'"  

----------

(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

Was this answer helpful?


2 additional answers

Sort by: Most helpful
  1. Limitless Technology 40,116 Reputation points
    2021-09-14T09:15:10.447+00:00

    Hello PFSIT,

    The Filter parameter indeed takes strings and not code blocks, so it should be between quotes, also would like to introduce you to the tested properties to be applicable for the Filter parameter in Exchange.

    https://learn.microsoft.com/en-us/powershell/exchange/filter-properties?view=exchange-ps

    Hope this may be helpful for you,
    Best regards,

    Was this answer helpful?

    0 comments No comments

  2. Rich Matheisen 48,121 Reputation points
    2021-09-13T19:33:35.34+00:00

    The -Filter takes a string as an argument, not a code block. It's a good idea to consult the help for a cmdlet (either online or using help cmdlet-name).

    get-distributiongroup

    Follow Andreas' advice. ;-)

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.