Link to home
Start Free TrialLog in
Avatar of mlee
mlee

asked on

Exchange mailbox database disabled accounts cmdlet

Hello, I have 10 databases in my Exchange Server, and I'm trying to get only the COUNT of the number of disabled mailboxes in ONE DATABASE. I'm able to get the TOTAL amount of 10 disabled/Active databases total, but I need to get the COUNT of disabled mailboxes PER database. Any ideas how I can get this?
Avatar of Todd Nelson
Todd Nelson
Flag of United States of America image

What command are you running?  Please provide as a reference.
Avatar of mlee
mlee

ASKER

So this cmdlet works but it gets me the TOTAL number of disabled accounts out of all mailbox databases:
(Get-aduser –filter *|where {$_.enabled –eq “True”}).count

This command gets me no output:
Get-MailboxDatabase <Database Name>|Get-MailboxStatistics |Where {$_.DisconnectReason –eq “Disabled

This command gives output, but only 0:
(Get-MailboxStatistics –Database <Database Name>|where {$_.DisconnectDate –ne $null}).count

I tried this command as well but no output:
foreach ($DB in $DBs) {Get-MailboxStatistics –Database $DB | where {$_.DisconnectDate –ne $null } | select Database.DisplayName.DisconnectDate,@{n=”MemberCount”;e={(Get-MailboxStatistics –Database $DB | where { $_.DisconnectDate-ne $null } ).Count}}}

I need to get the COUNT of disabled accounts PER Database. I've been working on this for over a week and still can't figure it out. Any help would be great.

Thanks,
Matt
ASKER CERTIFIED SOLUTION
Avatar of Todd Nelson
Todd Nelson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial