Please find some useful powershell commands below.
To get all the disabled AD accounts:
Get-User | where {$_.useraccountcontrol -like “*accountdisabled*”}
To get disabled AD accounts which are not associated with mailbox:
Get-User | where {$_.useraccountcontrol -like “*accountdisabled*”} | where {$_.recipienttypedetails -ne “usermailbox”}
To get disabled AD accounts which are associated with mailbox:
Get-User | where {$_.useraccountcontrol -like “*accountdisabled*”} | where {$_.recipienttypedetails -eq “usermailbox”}
To get the mailboxes which are associated with disabled AD accounts:
Get-User -RecipientTypeDetails UserMailbox | where {$_.UseraccountControl -like “*accountdisabled*”}
To get the mailboxes which are not associated with disabled AD accounts:
Get-User -RecipientTypeDetails UserMailbox | where {$_.UseraccountControl -notlike “*accountdisabled*”}
Thanks, Cheers!!!
Kottees