Exchange 2010 PowerShell Script to gather all Disabled Mailboxes/Users

Hi, we have a Exchange 2010 env't and I would like to know what command to run which will output all my users whose Exchange Mailboxes are disabled.
nutekconsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AmitIT ArchitectCommented:
Here is the command. Refer: https://technet.microsoft.com/en-us/library/bb232039(v=exchg.150).aspx

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -eq "Disabled" } | ft DisplayName,Database,DisconnectDate
0
Will SzymkowskiSenior Solution ArchitectCommented:
Use the following command...
Get-MailboxStatistics -Server "MailboxServerName" | ? {$_.DisconnectReason -eq "Disable"} | 
select DisplayName, DisconnectDate, DisconnectReason | 
Export-csv "c:\DisabledMailboxes.csv" -nti

Open in new window


This will export the results to a CSV file.

Will.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vincent BurtonCommented:
You may try this Get-MailboxReport.ps1 – PowerShell Script to Generate Mailbox Reports: http://exchangeserverpro.com/powershell-script-create-mailbox-size-report-exchange-server-2010/

Managing Disconnected Exchange Mailboxes with PowerShell: http://mikepfeiffer.net/2010/06/managing-disconnected-exchange-mailboxes-with-powershell/

Here I found and another informative article about the Microsoft Active Directory Windows PowerShell cmdlets, and use them to find active and disabled users: http://blogs.technet.com/b/heyscriptingguy/archive/2011/08/29/use-active-directory-cmdlets-with-powershell-to-find-users.aspx

Get the list of the disconnected mailboxes:

Get-MailboxStatistics -Server <server> | where { $_.DisconnectDate -ne $null } | select DisplayName,DisconnectDate

Replace <server> with your mailbox server.

Try this:  Get-Mailbox |?{$_.UserAccountControl -Match "AccountDisabled"}| Fl Name,Database,UserAccountControl

Hope it helps you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.