Export User List

on
Hi,
Hi,

Im using exchange 2010SP1
i need to get a list of all users with mailboxes and their all email aliases, and current mailbox size and export it csv file

What command would do the trick ?

Thanks

Comment
Watch Question

Do more with

EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
i forgot to add that i will need Email Group user belongs to aswell.

Cheers

Commented:
Thanks it helped (no group membership tho.

do you know by anychance how to get list of mailboxes that have forwarding enabled and its forwarding email address
Top Expert 2008
Commented:
Hello there,

you can use the Exchange Management Shell to get a list of whatever you want. Here's a solution which does what you want, except for the distribution groups, since that is a bit complicated because there's no reference from the mailbox to the distribution group, but only the other way round, so we would have to iterate through all the distribution groups in your organization and check if the user is a member of one of them.
$csv = @() foreach ($mb in Get-Mailbox)
{
$mbs = Get-MailboxStatistics$mb
$emails = ""; foreach($ea in $mb.EmailAddresses) { if($emails -eq "")
{
$emails =$ea.SmtpAddress;
}
else
{
$temp =$ea.SmtpAddress
$emails = "$emails,$temp"; } }$line = new-object system.object
$line | add-member -type NoteProperty -name Name -value$mb.Name
$line | add-member -type NoteProperty -name Emails -value$emails
$line | add-member -type NoteProperty -name Size_in_MB -value$mbs.TotalItemSize.Value.ToMB()
$line | add-member -type NoteProperty -name InternalForward -value$mb.ForwardingAddress
$line | add-member -type NoteProperty -name ExternalForward -value$mb.ForwardingSmtpAddress.SmtpAddress
$csv +=$line
}
$csv | ConvertTo-Csv  Commented: thanks, go do i run above script ? do i have to save it as ? Top Expert 2008 Commented: You can just copy and paste it into the exchange management shell (hit return twice after the paste has finished and the prompt still shows ">>". The script will output the CSV directly onto the powershell console, you can use the Export-CSV cmdlet instead of ConvertTo-Csv to save it to a file. To do that, just replace the last line with:$csv | Export-Csv -FilePath c:\path\to\file.csv

You can also save it as a .ps1 file and run it directly from the exchange management shell.

Commented:

i get an error :

Export-Csv : A parameter cannot be found that matches parameter name 'FilePath'.
At line:25 char:28
+ \$csv | Export-Csv -FilePath <<<<  c:\file.csv
+ CategoryInfo          : InvalidArgument: (:) [Export-Csv], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.ExportCsvCommand
Top Expert 2008

Commented:
Sorry, it's just "-Path" and not "-FilePath".

Commented:
Thanks a lot !!!

Do more with