I was involved to deploy Exchange Hybrid for office 365 project and find the below powershell script to Getting Existing users mailbox size with location while gathering exchange 2007 information.
Run the below script on Exchange 2007 server
$exchangeservers = Get-MailboxServer
$AllUsers = @()
$AllUsersEmail = @()
foreach ($server in $exchangeservers)
{
$AllUsers += Get-Mailbox -Server $server |Get-MailboxStatistics |select servername,displayname,itemcount,totalitemsize
}
foreach ($user in $AllUsers)
{
$obj = new-object psObject
$mailinfo = get-mailbox -identity $user.displayname |select PrimarySMTPAddress,Office, DistinguishedName
$tmp = [adsi]("LDAP://" + $mailinfo.DistinguishedName)
$obj |Add-Member -MemberType noteproperty -Name "Server Name" -Value $user.ServerName
$obj |Add-Member -MemberType noteproperty -Name "Display Name" -Value $user.DisplayName
$obj |Add-Member -MemberType noteproperty -Name "Item Count" -Value $user.ItemCount
$obj |Add-Member -MemberType noteproperty -Name "Total Item Size" -Value $user.TotalItemSize.value.toMB()
$obj |Add-Member -MemberType noteproperty -Name "Email Address" -Value $mailinfo.PrimarySMTPAddress
$obj |Add-Member -MemberType noteproperty -Name "Office" -Value $mailinfo.Office
$obj |Add-Member -MemberType noteproperty -Name "Description" -Value $tmp.description
$AllUsersEmail += $obj
}
$AllUsersEmail |Export-Csv c:\test.csv -NoTypeInformation
Run the below script on Exchange 2007 server
$exchangeservers = Get-MailboxServer
$AllUsers = @()
$AllUsersEmail = @()
foreach ($server in $exchangeservers)
{
$AllUsers += Get-Mailbox -Server $server |Get-MailboxStatistics |select servername,displayname,itemcount,totalitemsize
}
foreach ($user in $AllUsers)
{
$obj = new-object psObject
$mailinfo = get-mailbox -identity $user.displayname |select PrimarySMTPAddress,Office, DistinguishedName
$tmp = [adsi]("LDAP://" + $mailinfo.DistinguishedName)
$obj |Add-Member -MemberType noteproperty -Name "Server Name" -Value $user.ServerName
$obj |Add-Member -MemberType noteproperty -Name "Display Name" -Value $user.DisplayName
$obj |Add-Member -MemberType noteproperty -Name "Item Count" -Value $user.ItemCount
$obj |Add-Member -MemberType noteproperty -Name "Total Item Size" -Value $user.TotalItemSize.value.toMB()
$obj |Add-Member -MemberType noteproperty -Name "Email Address" -Value $mailinfo.PrimarySMTPAddress
$obj |Add-Member -MemberType noteproperty -Name "Office" -Value $mailinfo.Office
$obj |Add-Member -MemberType noteproperty -Name "Description" -Value $tmp.description
$AllUsersEmail += $obj
}
$AllUsersEmail |Export-Csv c:\test.csv -NoTypeInformation