locked
Exchange Powershell, search for * not wildcard RRS feed

  • Question

  • Hi

    I am trying to search for all mailboxes where the displayname contains the character *

    Something like this.

    Get-MailboxDatabase X | Get-Mailbox | where {$_.Displayname -contains '*'}

    How do I do this, without Powershell thinks I am using a wildcard.

    I have searched the internet, asked in forums - I still am not able to do this :-)

    BR
    Steen

    Tuesday, November 4, 2014 8:51 AM

Answers

  • Hi Steen,

    You can also use the following:

    Get-Mailbox | Where{$_.displayname -match "\*"}


    Nico Martens - MCTS, MCITP
    SharePoint Infrastructure Consultant / Trainer

    • Marked as answer by steenpedersen Tuesday, November 4, 2014 9:42 AM
    Tuesday, November 4, 2014 9:27 AM

All replies

  • Hi

    Found the answer.

    where {$_.Displayname.Contains("*")}

    BR
    Steen

    Tuesday, November 4, 2014 9:11 AM
  • Hi Steen,

    You can also use the following:

    Get-Mailbox | Where{$_.displayname -match "\*"}


    Nico Martens - MCTS, MCITP
    SharePoint Infrastructure Consultant / Trainer

    • Marked as answer by steenpedersen Tuesday, November 4, 2014 9:42 AM
    Tuesday, November 4, 2014 9:27 AM
  • Hi Nico

    Thanks, that was even better. That reminds me of the syntax I know. 

    BR
    Steen

    Tuesday, November 4, 2014 9:42 AM