Forum Discussion

Mikeyhelpmeplease's avatar
Mikeyhelpmeplease
Copper Contributor
Jun 11, 2024

Cannot get "$_.hiddenfromaddresslistsenabled -eq $true" to work with other parameters.

Hi Cannot get this command to work. Tried different variations and commands.

 

Get-Mailbox | Where-Object {$_.IsLicensed -eq $true -and $_.BlockCredential -eq $false -and $_.hiddenfromaddresslistsenabled -eq $true}

 

The below works fine:

Get-Mailbox | Where-Object {$_.IsLicensed -eq $true -and $_.BlockCredential -eq $false}

 

Can anyone help?

  • Not sure how you are testing this, but there are no IsLicensed and/or BlockCredential properties for Get-Mailbox. You seem to be confusing the cmdlet with Get-MsolUser or similar.
    If you want to filter purely based on Exchange attributes, use SKUAssigned for the license part, and AccountDisabled/ExchangeUserAccountControl for the sign-in status. Do keep in mind that Exchange is NOT authoritative for either of these two attributes though, so it's best to get them via Entra ID.
    • Mikeyhelpmeplease's avatar
      Mikeyhelpmeplease
      Copper Contributor
      Hi Vasil, my apologies, I'm not a PowerShell expert. What I am trying to find is a command that will give me active or exchange licensed accounts that have the "Show in address book" option off.

      I have got this working by itself:
      Get-Mailbox -ResultSize Unlimited | Where-Object {$_.hiddenfromaddresslistsenabled -eq $True}

      I'm hoping there is a way to get those same results (Hidden from address book) but for active or exchange licensed (E1) or alternatively non blocked accounts.
      • VasilMichev's avatar
        VasilMichev
        MVP
        As mentioned above, you can get similar data via the SKUAssigned property:

        Get-Mailbox -Filter {hiddenfromaddresslistsenabled -eq $true} | ? {$_.SKuAssigned}

Resources