PowerShell Script to extract OWA status in Exchange Online.

First connect to Exchange online.

Set-ExecutionPolicy RemoteSigned
Install-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true

Excute the below command all at once.

# Get OWA enabled and disabled mailboxes
$OWAEnabledMailboxes = Get-CASMailbox -Filter {OWAEnabled -eq $true} -ResultSize Unlimited
$OWADisabledMailboxes = Get-CASMailbox -Filter {OWAEnabled -eq $false} -ResultSize Unlimited

# Create a custom object for each mailbox
$OWAEnabledMailboxInfo = $OWAEnabledMailboxes | Select-Object DisplayName, Alias, OWAEnabled
$OWADisabledMailboxInfo = $OWADisabledMailboxes | Select-Object DisplayName, Alias, OWAEnabled

# Specify the CSV file path
$CSVFilePath = “C:\File.csv”

# Combine OWA enabled and disabled mailbox information
$CombinedMailboxInfo = $OWAEnabledMailboxInfo + $OWADisabledMailboxInfo

# Export the combined information to CSV
$CombinedMailboxInfo | Export-Csv -Path $CSVFilePath -NoTypeInformation

Leave a Comment