I cant get this to work isclutterenabled

Welcome Forums General PowerShell Q&A I cant get this to work isclutterenabled

This topic contains 5 replies, has 2 voices, and was last updated by

 
Participant
3 years, 3 months ago.

  • Author
    Posts
  • #35378

    Participant
    Topics: 1
    Replies: 2
    Points: 0
    Rank: Member

    Evening All, i'm sure this is a really basic issue, but I really cant understand it.

    i'm running this

    Get-Mailbox | Get-Mailboxstatistics | Where-Object isclutterenabled -eq "False"

    I want to see all the users that have isclutterenabled = false, but it only returns the one user that has it enabled or true, even if I change the -eq "False" to -eq "True", I get exactly the same result the one user that has it enabled, please can someone explain what im doing wrong.

    Regards Dean

  • #35379

    Participant
    Topics: 3
    Replies: 262
    Points: 68
    Helping Hand
    Rank: Member

    I don't have an exchange environment to test, but try this.

    Get-Mailbox | Get-Mailboxstatistics | Where-Object {$_.isclutterenabled -eq $False}
    
  • #35380

    Participant
    Topics: 1
    Replies: 2
    Points: 0
    Rank: Member

    Yes that worked perfectly, can I ask what yours means, and why mine didn't work, I hate not understanding something.

  • #35382

    Participant
    Topics: 3
    Replies: 262
    Points: 68
    Helping Hand
    Rank: Member

    You didn't use the "$_" variable and "{ }" scriptblock. The variable is used to specify the current object in the pipeline and "{ }" specifies the filterscript used by Where-Object cmdlet.

  • #35384

    Participant
    Topics: 1
    Replies: 2
    Points: 0
    Rank: Member

    Ok I think I get that now, I tried though to use what i've learnt in a different example

    Get-Mailbox | Get-Mailboxstatistics | Where-object {$_.displayname -contains "Dean"}
    or
    Get-Mailbox | Get-Mailboxstatistics | Where-object {$_.displayname -contains "Dean*"}

    but neither returns my users called Dean, I get nothing back, confused again???

  • #35389

    Participant
    Topics: 3
    Replies: 262
    Points: 68
    Helping Hand
    Rank: Member

    The comparison operator, -contains, is used with arrays or collections. Use –like or –match with your examples.

    PS > @(1..10) -contains 5
    True
    PS > @(1..10) -contains 11
    False
    
    Ex: Get-Mailbox | Get-Mailboxstatistics | Where-object {$_.displayname -like "*Dean*"}
    Get-Mailbox | Get-Mailboxstatistics | Where-object {$_.displayname –match 'Dean'}
    

    I recommend the following books.
    PowerShell TFM 4th Ed
    PowerShell In Action 2nd Ed

The topic ‘I cant get this to work isclutterenabled’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort