none
Number of mailboxes per database RRS feed

  • Question

  • 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?
    Saturday, November 26, 2011 3:05 PM

Answers

  • 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
    • Proposed as answer by Xiu Zhang Tuesday, November 29, 2011 8:03 AM
    • Marked as answer by Xiu Zhang Wednesday, December 7, 2011 9:20 AM
    Monday, November 28, 2011 3:28 AM

All replies

  • 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
    • Proposed as answer by Kranthi-EX Sunday, November 27, 2011 3:12 AM
    Saturday, November 26, 2011 4:27 PM
  • 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
    • Proposed as answer by Kranthi-EX Sunday, November 27, 2011 3:12 AM
    Saturday, November 26, 2011 4:29 PM
  • 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?

    Sunday, November 27, 2011 7:49 PM
  • 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
    • Proposed as answer by Xiu Zhang Tuesday, November 29, 2011 8:03 AM
    • Marked as answer by Xiu Zhang Wednesday, December 7, 2011 9:20 AM
    Monday, November 28, 2011 3:28 AM