Get all mailboxes with IMAP enabled using powershell

To get all mailboxes with IMAP enabled using powershell, use the command below Get-CASMailbox -resultsize unlimited | where {$_.IMAPEnabled} | select Name, SamAccountName