none
Pulling OWAEnabled and JobTitle. RRS feed

  • Pregunta

  • Hello,

    I am trying to get a script together where I can pull out OWAEnabled, Title and DisplayName. However it doesnt seem to be working out quite right. I only need this to be for Enabled users. This is being run in Exchange 2010.

    I have the following: 

    Get-CASMailbox -ResultSize Unlimited | where-object{ (Get-User $_.Alias).UserAccountControl -no
    tmatch 'AccountDisabled' -and $_.OWAEnabled -eq $true} | Select Alias, DisplayName, OWAEnabled | export-csv C:\Scripts\OWAEnabled.csv -NoTypeInformation

    Please could you assist in where I am going wrong?

    Thanks

    jueves, 16 de enero de 2020 17:05

Todas las respuestas

  • First you code has a line break in the middle:

    Get-CASMailbox -ResultSize Unlimited | 
        where-object{ 
            $_.OWAEnabled  -and
            (Get-User $_.Alias).UserAccountControl -notmatch 'AccountDisabled'
        } | 
        Select Alias, DisplayName, OWAEnabled | 
        export-csv C:\Scripts\OWAEnabled.csv -NoTypeInformation
    

    Also note that UAC is not a string - it is a "flags" type.

    See: UserAccountControl


    \_(ツ)_/

    jueves, 16 de enero de 2020 18:00
    Moderador
  •     where-object{ 
            $uac = (Get-User $_.Alias).UserAccountControl
            $_.OWAEnabled  -and
            (-not ($uac -band  [Microsoft.Exchange.Data.Directory.Recipient.UserAccountControl]::AccountDisabled))
        } | 


    \_(ツ)_/


    jueves, 16 de enero de 2020 18:03
    Moderador
  • Thank you how do I get the Title field out though that is where I am struggling? 


    viernes, 17 de enero de 2020 11:20
  • You have to query the user object for the JobTitle.  You are not referencing it anywhere.

    The Title is not part of the ExchangeUser object so you will have to query AD for the user and get teh title.


    \_(ツ)_/



    viernes, 17 de enero de 2020 16:03
    Moderador