Mr Woober
asked on
Exchange Powershell - How to get emailaddress
Tired of searching and testing and failing. Assume this would be an very easy one :)
get-mailbox | get-mailboxstatistics | select displayname,TotalItemSize, LastLogonT ime,Primar ySmtpAddre ss
This is the thing i need. But having trouble getting the email address to the select. How can this be done in an easy way ?
Also looked at :
$Mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($Mailbox in $Mailboxes)
{
$Mailbox | Add-Member -MemberType "NoteProperty" -Name "MailboxSizeMB" -Value ((Get-MailboxStatistics $Mailbox).TotalItemSize.Va lue.ToMb() )
}
$Mailboxes | Sort-Object MailboxSizeMB -Desc | Select MailboxSizeMB,TotalItemSiz e,Count | Export-Csv -NoType "C:\temp\Mailboxessize.csv "
Any suggestions ?
get-mailbox | get-mailboxstatistics | select displayname,TotalItemSize,
This is the thing i need. But having trouble getting the email address to the select. How can this be done in an easy way ?
Also looked at :
$Mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($Mailbox in $Mailboxes)
{
$Mailbox | Add-Member -MemberType "NoteProperty" -Name "MailboxSizeMB" -Value ((Get-MailboxStatistics $Mailbox).TotalItemSize.Va
}
$Mailboxes | Sort-Object MailboxSizeMB -Desc | Select MailboxSizeMB,TotalItemSiz
Any suggestions ?
$Mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($Mailbox in $Mailboxes)
{
$obj = new-object psobject
$obj | Add-Member -MemberType "NoteProperty" -Name "MailboxSizeMB" -Value ((Get-MailboxStatistics $Mailbox).TotalItemSize.Value.ToMb())
$obj | add-member noteproperty Email -value $mailbox.emailaddresses
write-output $obj
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could get away with
get-mailbox | export-csv c:\test.csv
or
get-mailbox | get-mailboxstatistics | select DisplayName,ItemCount,Tota lItemSize | export-csv "MailboxSizes.csv"
get-mailbox | export-csv c:\test.csv
or
get-mailbox | get-mailboxstatistics | select DisplayName,ItemCount,Tota
should get you the mail address