[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

Size of EDB files on multiple Exchange 2007 servers

We are running Exchange 2007 SP3.  I have multiple maibox servers following this format:

Name: LONEXCH1, LONEXCH2, LONEXCH3 .. LONEXCH20
DB's: LONEXCH1SG1DB1, LONEXCH1SG2DB1 etc

I would like to grab a report of all the EDB files on say LONEXCH1 - LONEXCH10.

Is this possible in Powershell?
0
richlionel
Asked:
richlionel
  • 6
  • 3
  • 3
  • +1
1 Solution
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-MailboxDatabase | Where {$_.MailboxDatabse -Like "*LONEXCH1*"} | FL Name, EdbFilePath, LogfolderPath

- Rancy
0
 
Exchange_GeekCommented:
Correction the above post is based not on the Exchange Server.

Run this one basis for all the servers starting with name LONEXCH

Get-MailboxDatabase | Where {$_.Server -Like "*LONEXCH"} | Select-Object Name, Server,EdbFilePath, LogfolderPath

If you'd need more details from it, run this cmdlet.

C:\>Get-MailboxDatabase | Where {$_.Server -Like "*LONEXCH"} | Get-MailboxStatistics | Sort totalitemsize -desc | Export-CSV C:\mailboxes.csv

Regards,
Exchange_Geek
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-MailboxDatabase | Where {$_.Server -Like "*LONEXCH"} | Get-MailboxStatistics | select ServerName, Name, DatabaseSize |Sort DatabaseSize -desc

- Rancy
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
AkulshCommented:
To get the size of databases, you need to use '-status' also, like this:

Get-MailboxDatabase -status | Where {$_.Server -Like "LONEXCH*"} | select Name, Server, EdbFilePath, DatabaseSize, LogfolderPath

This will give the output as a list. To get a CSV file, append something like the following command:

| export-csv C:\temp\ExchDatabase.csv

Ajay
0
 
richlionelAuthor Commented:
Thank you everyone, I am back in the office on Monday so will try these out!
0
 
Exchange_GeekCommented:
Wonderful, I'll check in again to see if you need any help - if you are stuck somewhere, feel free to comment and we'll jump in to rescue you, and BTW it's weekend go have you're beer.

Cheers,
Exchange_Geek
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Perfect ... please do and share your feedback so that if required we can assist you with the same.

- Rancy
0
 
richlionelAuthor Commented:
Thanks everyone, but it doesn't work. The value for Databasesize is empty (maybe this feature is in Exchange 2010 only).

I've read we need to use Get-ChildItem to get the actual EDB size.

All our EDB's are on F:\<DB_Name>\<db_name>.edb on ALL our servers if that's any help?
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-MailboxDatabase | Select Server, StorageGroupName, Name, @{Name="Size (GB)";Expression={$objitem = (Get-MailboxDatabase $_.Identity); $path = "`\`\" + $objitem.server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((Get-ChildItem $path).length)/1048576KB; [math]::round($size, 2)}}, @{Name="Size (MB)";Expression={$objitem = (Get-MailboxDatabase $_.Identity); $path = "`\`\" + $objitem.server +"`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2); $size =((Get-ChildItem $path).length)/1024KB; [math]::round($size, 2)}}, @{Name="No. Of Mbx";expression={(Get-Mailbox -Database $_.Identity | Measure-Object).Count}} | sort StorageGroupName

http://social.technet.microsoft.com/Forums/en-US/exchangesvrmonitoring/thread/c80b636a-4764-469d-80b9-4717ffc48b06

- Rancy
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Maybe this can help as well .... lot of scripts and people around :)

http://www.powershellcommunity.org/Forums/tabid/54/aft/1110/Default.aspx

- Rancy
0
 
richlionelAuthor Commented:
Thanks, I saw this one:

$exchangeservers = Get-ExchangeServer |where-object {$_.admindisplayversion.major -eq 8 -and $_.IsMailboxServer -eq $true }
foreach ($server in $exchangeservers)
{
$db = Get-MailboxDatabase -server $server
foreach ($objItem in $db)
{
$edbfilepath = $objItem.edbfilepath
$path = "`\`\" + $server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2)
$dbsize = Get-ChildItem $path
$dbname = $objitem.identity |SELECT parent,name
$dbname = $dbname.Parent.ToString() + "`\" + $dbname.Name.ToString()
$output = "Server " + $server + ", Database " + $dbname +", Size(KB) " + $dbsize.Length
Write-Output $output
}
}

But I'm not sure where to enter the path of my EDB files for my servers?
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
You dont have to enter the EDB path thats what the Script needs to do ....

- Rancy
0
 
Exchange_GeekCommented:
Christ sake, this is getting soooooooooooooooooo long a thread.

Why not simply run a simple Exchange tool (one of the best ever released by MS Product team). It s called Exchange Best Practice Analyser tool. You'll need to run this tool from any Exchange Server - it is already integrated into the Exchange Management Console.

Go to EMC - Toolbox, select ExBPA (Full form stated above). Select the servers you'd want to run and voila....for 2mins max - you'll get to read each server's database + mailbox count + issues on each server + solutions to those issues + Active Directory structure ......

the list is endless, simply read the informational part of it - and you won't need to store all these scripts ever :) :) :)

Regards,
Exchange_Geek
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 6
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now