My PowerShell

Windows Powershell scripts, examples, tips, docs …

View number of User Accounts in AD and Mailboxes in Exchange

There are a few examples to display how many users you have in AD, how many users that are enabled and also how many that are disabled.

Number of User Accounts

(get-aduser –filter *).count

Number of Enabled User Accounts

(get-aduser -filter *|where {$_.enabled -eq “True”}).count

Number of Disabled User Accounts

(get-aduser -filter *|where {$_.enabled -ne “False”}).count

Number of Exchange Mailboxes

(get-mailbox -ResultSize Unlimited ).count

Number of Distribution Groups in Exchange

(Get-DistributionGroup).count

Leave a Response