tech2010
asked on
Count Mailboxes in Exchange 2000
Is there any way i can count how many mailboxes i have got and size if possible on my two exchange server 2000.
I have got 4 storage groups and one store in each storage group on both servers. Thanks
I have got 4 storage groups and one store in each storage group on both servers. Thanks
Alas neither of those will work. The more useful parts of the WMI interface for Exchange were only introduced with Exchange 2003. For Exchange 2000 you would have to use MAPI to get sizes of individual mailboxes.
I have a script that does that here:
http://www.highorbit.co.uk/?p=618
It's been a long time since I had a chance to test it. I hope it still works!
Chris
ASKER
Hi florin_s, I had already seen the link. That script only works with Exchange 2003.
Chris-Dent, I am not intresting in Size. I want to know how many mailboxes i have on my exchange 2000.
Chris-Dent, I am not intresting in Size. I want to know how many mailboxes i have on my exchange 2000.
That simplifies things. You're better using LDAP queries against Active Directory to find that.
Each user account which has a mailbox has a few attributes that can be used to identify it. If you're interested in "per store" then we want to arrange them by the homeMDB attribute.
I think PowerShell would still give us the quickest way to get this information without having to bother about lots of VbScript for searching AD. If you're happy with that, could you grab PowerShell from here:
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx
And the Quest Cmdlets from here (also free):
http://www.quest.com/activeroles-server/arms.aspx
Once we have those, we can start with:
$Users = Get-QADUser -IncludedProperties homeMDB -LdapFilter "(homeMDB=*)" | Select-Object Name, DistinguishedName, homeMDB
That means that all users across all stores (and all servers) is given by:
$Users.Count
Would you want a count per store or per server as well? It's pretty easy to pull out of the data we have in $Users.
Chris
ASKER
I would like count per store and per server. Thanks
Fair enough. Can we give this a try? See if it's what you're after.
It'll need to be run as an Exchange Admin, only admins have access to the parts of the Exchange tree it hooks into to grab the owning server for a store. There are other ways if that's not desirable, this just saves us trying to rip it out of the homeMDB string.
Chris
$Users = Get-QADUser -IncludedProperties homeMDB -LdapFilter "(homeMDB=*)" | Select-Object Name, DN, homeMDB
$homeMDBValues = $Users | Select-Object homeMDB -Unique
$Stores = @(); $homeMDBValues | %{
$Stores += Get-QADObject $_.homemdb -IncludedProperties msExchOwningServer | `
Select-Object Name, @{n='Server';e={ (Get-QADObject $_.msExchOwningServer).Name }}, `
@{n='homeMDB';e={ $_.distinguishedName }}
}
$Temp = @()
ForEach ($User in $Users) {
$Store = $Stores | ?{ $_.homeMDB -eq $User.homeMDB }
$Temp += $Store | Select-Object @{n='UserName';e={ $User.Name }}, @{n='UserDN';e={ $User.DN }}, `
Name, Server
}
$Users = $Temp
# Total User Count
Write-Host "Total: $($Users.Count)"
# Count per server
ForEach ($Server in ($Users | Select-Object Server -Unique)) {
Write-Host "$($Server.Server): $(($Users | ?{ $_.Server -eq $Server.Server }).Count)" }
# Count per store
ForEach ($Store in ($Users | Select-Object Name -Unique)) {
Write-Host "$($Store.Name): $(($Users | ?{ $_.Name -eq $Store.Name }).Count)" }
ASKER
I am bit carefull to use this script on my production exchange.
It only reads information, no writing in there. It only actually needs read access to the Exchange configuration tree, a View Only Admin is likely to be enough if that makes it a bit more comfortable.
Chris
Here you go, a modification that rips apart the homeMDB string to return the same thing. Can be run with a regular user account, only needs read access to AD (which a regular user will have).
Chris
$Users = Get-QADUser -IncludedProperties homeMDB -LdapFilter "(homeMDB=*)" | Select-Object Name, DN, homeMDB
$Temp = @()
$Users | %{
$HomeMDB = ($_.HomeMDB).Split("=")
$Store = $HomeMDB[1].SubString(0, $HomeMDB[1].LastIndexOf(","))
$Server = $HomeMDB[4].SubString(0, $HomeMDB[4].LastIndexOf(","))
$Temp += $_ | Select-Object Name, DN, @{n='Store';e={ $Store }}, @{n='Server';e={ $Server }}
}
$Users = $Temp
# Total User Count
Write-Host "Total: $($Users.Count)"
# Count per server
ForEach ($Server in ($Users | Select-Object Server -Unique)) {
Write-Host "$($Server.Server): $(($Users | ?{ $_.Server -eq $Server.Server }).Count)" }
# Count per store
ForEach ($Store in ($Users | Select-Object Store -Unique)) {
Write-Host "$($Store.Store): $(($Users | ?{ $_.Store -eq $Store.Store }).Count)" }
ASKER
what exactly this script will do?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
here is a nice script for this:
http://smtp25.blogspot.com/2007/08/mail-box-count-script_4766.html
and here is also an interesting link:
https://www.experts-exchange.com/questions/23379099/Powershell-script-snippet-to-count-subtotal-Exchange-2003-mail-messages-by-message-class.html