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 Office Online Server
Microsoft Office Online Server
Microsoft on-premises server product that runs Office Online. Previously known as Office Web Apps Server.
609 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,435 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 100.6K Reputation points MVP
    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


2 additional answers

Sort by: Most helpful
  1. Rich Matheisen 45,431 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. ;-)


  2. Limitless Technology 39,471 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,

    0 comments No comments