title: Powershell report from Exchange and AD
body: <p>I've got this script that gives me report about AD users that are OWA enabled.</p>
  
  <p>I need to add to this users who have owe disabled. </p>
  
  <p>Anyone out there who knows how I change this script to get that result to?</p>
  
  <pre><code>Import-Module "ActiveDirectory"
  
  $mailboxes = Get-CASMailbox -ResultSize 10000
  
  "DisplayName;ActiveSync;Owa;SamAccountName;ExpiriationDate;AccountStatus;Department;Title;Description;Company;Office;LastLogonTime;"
  
  foreach ($m in $mailboxes) {
    $Display=$false
    if ($m.OWAEnabled        -eq $true) { $Display=$true }
    if ($Display -eq $true) {
      $a = Get-ADUser $m.DistinguishedName -properties *
      $s = Get-MailboxStatistics $m.DistinguishedName
      "{0};{1};{2};{3};{4};{5};{6};{7};{8};{9};{10};{11};" -f $m.DisplayName,$m.ActiveSyncEnabled,$m.OWAEnabled,$m.samAccountName,$a.AccountExpirationDate,[string]$a.Enabled,$a.Department,$a.title,$a.description,$a.company,$a.office,$s.LastLogonTime
    }
  
  }
  </code></pre>