Hi SpiceHeads,<\/p>\n
I’ve just spent about an hour trying to get my Exchange 2010 users export with no luck. I need: DisplayName, MailboxSize, LastLogonTime, PrimarySmtpAddress, AllAliases in one .csv<\/p>\n
I need to merge this 2 simplified queries into one:<\/p>\n
Get-Mailbox | Get-MailboxStatistics | select DisplayName, databasename, @{expression={$_.TotalItemSize.Value.ToMB()}}, LastLogonTime, LastLoggedOnUserAccount<\/p>\n
Get-Mailbox | Select DisplayName, PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$.EmailAddresses | Where-Object {$<\/em>.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}}<\/p>\n I’m not a shell fan Many thanks in advance, to get all SMTP address<\/p>\n try<\/p>\n Hi SpiceHeads,<\/p>\n I’ve just spent about an hour trying to get my Exchange 2010 users export with no luck. I need: DisplayName, MailboxSize, LastLogonTime, PrimarySmtpAddress, AllAliases in one .csv<\/p>\n I need to merge this 2 simplified queries into one:<\/p>\n Get-Mailbox | Get-MailboxStatistics | select DisplayName, databasename, @{expression={$_.TotalItemSize.Value.ToMB()}}, LastLogonTime, LastLoggedOnUserAccount<\/p>\n Get-Mailbox | Select DisplayName, PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$.EmailAddresses | Where-Object {$<\/em>.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}}<\/p>\n I’m not a shell fan Many thanks in advance, I was going to put something helpful together, but I actually found this out on a (ahem) different but similarly awesome site.<\/p>\n The “attribute here” would be the OU you want to search. If you only have one, or want them all, just remove it.<\/p>\n Props go to Edward van Biljon.<\/p>\n Hope this works for you!<\/p>\n AJ<\/p>","upvoteCount":1,"datePublished":"2020-06-29T15:37:44.000Z","url":"https://community.spiceworks.com/t/exchange-2010-ems-get-mailbox-get-mailboxstatistics/767644/2","author":{"@type":"Person","name":"spiceuser-14xad","url":"https://community.spiceworks.com/u/spiceuser-14xad"}},{"@type":"Answer","text":" You could also try the following script:<\/p>\n Many thanks!<\/p>","upvoteCount":0,"datePublished":"2020-07-07T14:14:56.000Z","url":"https://community.spiceworks.com/t/exchange-2010-ems-get-mailbox-get-mailboxstatistics/767644/5","author":{"@type":"Person","name":"latal","url":"https://community.spiceworks.com/u/latal"}}]}}
<\/p>\n
\nJarda<\/p>","upvoteCount":4,"answerCount":5,"datePublished":"2020-06-29T14:32:30.000Z","author":{"@type":"Person","name":"latal","url":"https://community.spiceworks.com/u/latal"},"acceptedAnswer":{"@type":"Answer","text":"get-mailbox | select -expand emailaddresses alias\n<\/code><\/pre>\n
$users = get-mailbox -resultsize unlimited\n$userarray = @()\nforeach ($user in $users){\n$stats= Get-MailboxStatistics $user.alias\n$datetime = $stats.LastLogonTime\n$date, $time = $datetime -split(' ')\n$Maildetails = New-Object -TypeName PSObject -Property @{\nDisplayName = $stats.DisplayName\nItemCount = $stats.ItemCount\nMailboxSize = $stats.TotalItemSize\nLastLogonDate = $date\nLastLogonTime = $time\nEmail = $user.primarysmtpaddress\nAlias=get-mailbox $user.alias | select -expand emailaddresses alias\n}\n$userarray += $Maildetails\n} \n$userarray \n<\/code><\/pre>","upvoteCount":0,"datePublished":"2020-06-29T16:04:03.000Z","url":"https://community.spiceworks.com/t/exchange-2010-ems-get-mailbox-get-mailboxstatistics/767644/3","author":{"@type":"Person","name":"jitensh","url":"https://community.spiceworks.com/u/jitensh"}},"suggestedAnswer":[{"@type":"Answer","text":"
<\/p>\n
\nJarda<\/p>","upvoteCount":4,"datePublished":"2020-06-29T14:32:30.000Z","url":"https://community.spiceworks.com/t/exchange-2010-ems-get-mailbox-get-mailboxstatistics/767644/1","author":{"@type":"Person","name":"latal","url":"https://community.spiceworks.com/u/latal"}},{"@type":"Answer","text":"$users = get-mailbox -organizationalunit \"attribute here\" -resultsize unlimited\n$userarray = @()\nforeach ($user in $users)\n{\n$MailUser = $user.UserPrincipalName\n$stats= Get-MailboxStatistics $MailUser\n$datetime = $stats.LastLogonTime\n$date, $time = $datetime -split(' ')\n$Maildetails = New-Object -TypeName PSObject -Property @{\nDisplayName = $stats.DisplayName\nItemCount = $stats.ItemCount\nMailboxSize = $stats.TotalItemSize\nLastLogonDate = $date\nLastLogonTime = $time\nEmail = $MailUser\n}\n$userarray += $Maildetails\n} \n$userarray | Export-Csv -Path C:\\Users1.csv\n<\/code><\/pre>\n
$mailboxes = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize unlimited\n$output = foreach($mailbox in $mailboxes){\n$mailbox | Get-MailboxStatistics | select DisplayName, databasename, @{n=\"TotalItemSize\";e={$_.TotalItemSize.Value.ToMB()}}, LastLogonTime, LastLoggedOnUserAccount, @{n=\"PrimarySmtpAddress\";e={$mailbox.PrimarySmtpAddress}}, @{Name=\"EmailAddresses\";Expression={$mailbox.EmailAddresses | Where-Object {$_.PrefixString -ceq \"smtp\"} | ForEach-Object {$_.SmtpAddress}}}\n}\n$output | Select DisplayName, DatabaseName, TotalItemSize, LastLogonTime, LastLoggedOnUserAccount, PrimarySmtpAddress, EmailAddresses | Export-Csv <CSV File Path>\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2020-06-30T05:37:09.000Z","url":"https://community.spiceworks.com/t/exchange-2010-ems-get-mailbox-get-mailboxstatistics/767644/4","author":{"@type":"Person","name":"ivan-wang","url":"https://community.spiceworks.com/u/ivan-wang"}},{"@type":"Answer","text":"