Number of mailboxes per database
Hi
We're running Exchange 2007 SP3.
Our mailbox servers are:
EMEA:
LONMBX-1
LONMBX-2
etc
ASIA
TOKMBX-1
TOKMBX-2
etc
I would like to find out:
1. The number of mailboxes per database on all London servers
2. The size of each database on all London servers
Is this possible using Powershell?
November 26th, 2011 10:16am
Hello Smith,
here you have answer for both questions:
http://exchangeshare.wordpress.com/2009/07/27/exchange-2007-database-statistics-in-powershell/
hope this helps.Thanks & Regards, Kottees
Free Windows Admin Tool Kit Click here and download it now
November 26th, 2011 11:38am
On Sat, 26 Nov 2011 15:05:14 +0000, Smith1974 wrote:
>Hi We're running Exchange 2007 SP3. Our mailbox servers are: EMEA: LONMBX-1 LONMBX-2 etc ASIA TOKMBX-1 TOKMBX-2 etc I would like to find out:
>1. The number of mailboxes per database on all London servers
Use the get-mailbox cmdlet.
>2. The size of each database on all London servers Is this possible using Powershell?
http://sysadmin-talk.org/2010/01/gathering-exchange-mailbox-database-sizes/
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
November 26th, 2011 11:40am
Thanks both.
Kottees - the script mentioned in that link was:
Get-MailboxDatabase | Select Server, StorageGroupName, Name, @{Name="Number Of Mailboxes";expression={(Get-Mailbox -Database $_.Identity | Measure-Object).Count}} | Format-Table -AutoSize
In effect this is doing a Get-Mailbox as part of the script - we have a pretty large environment so this takes forever, is anyone aware of any script that just gives me the number of mailboxes for our databases in a quicker manner?
Richard - your script will give the databases, but it mentions that the script needs to be run on each server "othwerwise the command would need to be modified to use UNC paths" [copied below]
Note: This command (and the following ones as well) need to be run on the mailbox server where the databases are located, otherwise the commands would need to be modified to use UNC paths.
Get-MailboxDatabase -Server SERVER01 | ForEach {Get-ChildItem $_.EdbFilePath | Format-List Name,Length}
Do you know what/how to use these UNC paths so that I can run this on just one server but be returned the EDB file size for all our databases?
Free Windows Admin Tool Kit Click here and download it now
November 27th, 2011 3:03pm
On Sun, 27 Nov 2011 19:49:10 +0000, Smith1974 wrote:
>
>
>Thanks both.
>
>Kottees - the script mentioned in that link was:
>
>Get-MailboxDatabase | Select Server, StorageGroupName, Name, @{Name="Number Of Mailboxes";expression={(Get-Mailbox -Database $_.Identity | Measure-Object).Count}} | Format-Table -AutoSize
>
>In effect this is doing a Get-Mailbox as part of the script - we have a pretty large environment so this takes forever, is anyone aware of any script that just gives me the number of mailboxes for our databases in a quicker manner?
>
>Richard - your script will give the databases, but it mentions that the script needs to be run on each server "othwerwise the command would need to be modified to use UNC paths" [copied below]
>
>Note: This command (and the following ones as well) need to be run on the mailbox server where the databases are located, otherwise the commands would need to be modified to use UNC paths. Get-MailboxDatabase -Server SERVER01 | ForEach {Get-ChildItem
$_.EdbFilePath | Format-List Name,Length}
>
>Do you know what/how to use these UNC paths so that I can run this on just one server but be returned the EDB file size for all our databases?
Instead of "X:\directory\file.edb" it would have to be
"\\server\X$\directory\file.edb".
Using WMI is pretty easy, and you don't have to use UNC names:
$f=get-wmiobject cim_datafile -filter "name='$_.EdbFilePath'"
-computername COMPUTER
$f.filesize
$f.name
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
November 27th, 2011 10:42pm
On Sun, 27 Nov 2011 19:49:10 +0000, Smith1974 wrote:
>
>
>Thanks both.
>
>Kottees - the script mentioned in that link was:
>
>Get-MailboxDatabase | Select Server, StorageGroupName, Name, @{Name="Number Of Mailboxes";expression={(Get-Mailbox -Database $_.Identity | Measure-Object).Count}} | Format-Table -AutoSize
>
>In effect this is doing a Get-Mailbox as part of the script - we have a pretty large environment so this takes forever, is anyone aware of any script that just gives me the number of mailboxes for our databases in a quicker manner?
>
>Richard - your script will give the databases, but it mentions that the script needs to be run on each server "othwerwise the command would need to be modified to use UNC paths" [copied below]
>
>Note: This command (and the following ones as well) need to be run on the mailbox server where the databases are located, otherwise the commands would need to be modified to use UNC paths. Get-MailboxDatabase -Server SERVER01 | ForEach {Get-ChildItem
$_.EdbFilePath | Format-List Name,Length}
>
>Do you know what/how to use these UNC paths so that I can run this on just one server but be returned the EDB file size for all our databases?
Instead of "X:\directory\file.edb" it would have to be
"\\server\X$\directory\file.edb".
Using WMI is pretty easy, and you don't have to use UNC names:
$f=get-wmiobject cim_datafile -filter "name='$_.EdbFilePath'"
-computername COMPUTER
$f.filesize
$f.name
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
November 28th, 2011 6:28am