Hello, I’m new to exchange and power shell I’m having difficulties to get this right; I’m trying to get the mailbox size of a list of specific alias from a csv file. this is what I’m doing:<\/p>\n
Import-CSV c:\\temp\\dupsmbx.csv
\n$accounts = Get-Mailbox -Identity $_.Alias<\/p>\n
Write-Host “Accounts Objects found: $($accounts.count)”<\/p>\n
$index = 0 The thing is that the script gets me back the first 1000 results instead of the specific alias from the csv How about like so?<\/p>\n Though I’m not sure if ‘Get-MailboxStatistics’ has the info you are trying to get with ‘select-object’<\/p>","upvoteCount":1,"datePublished":"2017-07-04T16:56:11.000Z","url":"https://community.spiceworks.com/t/get-mailbox-size-from-csv-exchange-online/591300/4","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},"suggestedAnswer":[{"@type":"Answer","text":" Hello, I’m new to exchange and power shell I’m having difficulties to get this right; I’m trying to get the mailbox size of a list of specific alias from a csv file. this is what I’m doing:<\/p>\n Import-CSV c:\\temp\\dupsmbx.csv Write-Host “Accounts Objects found: $($accounts.count)”<\/p>\n $index = 0 The thing is that the script gets me back the first 1000 results instead of the specific alias from the csv Welcome!<\/p>\n When you post code, Pease use the insert code button! Please and thank you<\/p>\n Hi Neally! Thank you for the quick reply! It works and gets the info as intended!<\/p>\n Thank you!<\/p>","upvoteCount":0,"datePublished":"2017-07-04T17:04:33.000Z","url":"https://community.spiceworks.com/t/get-mailbox-size-from-csv-exchange-online/591300/5","author":{"@type":"Person","name":"alexrossi","url":"https://community.spiceworks.com/u/alexrossi"}}]}}
\n$accounts | ForEach-Object{
\n$index++;
\nWrite-Host \"Working with: $($.Alias) ----> Processesing $index/$($accounts.Count)\"
\nGet-MailboxStatistics $<\/em>.alias | Select-Object DisplayName, TotalItemSize, ItemCount, LastLogonTime | Export-CSV c:\\temp\\DupsMailbox-Report.csv -NoTypeInformation
\nGet-Date
\n}<\/p>\n<\/p>","upvoteCount":3,"answerCount":5,"datePublished":"2017-07-04T16:37:54.000Z","author":{"@type":"Person","name":"alexrossi","url":"https://community.spiceworks.com/u/alexrossi"},"acceptedAnswer":{"@type":"Answer","text":"
foreach($mailbox in (Import-CSV c:\\temp\\dupsmbx.csv)){\n Get-MailboxStatistics $mailbox.alias | \n Select-Object DisplayName, TotalItemSize, ItemCount, LastLogonTime | \n Export-CSV c:\\temp\\DupsMailbox-Report.csv -NoTypeInformation -Append\n}\n<\/code><\/pre>\n
\n$accounts = Get-Mailbox -Identity $_.Alias<\/p>\n
\n$accounts | ForEach-Object{
\n$index++;
\nWrite-Host \"Working with: $($.Alias) ----> Processesing $index/$($accounts.Count)\"
\nGet-MailboxStatistics $<\/em>.alias | Select-Object DisplayName, TotalItemSize, ItemCount, LastLogonTime | Export-CSV c:\\temp\\DupsMailbox-Report.csv -NoTypeInformation
\nGet-Date
\n}<\/p>\n<\/p>","upvoteCount":3,"datePublished":"2017-07-04T16:37:54.000Z","url":"https://community.spiceworks.com/t/get-mailbox-size-from-csv-exchange-online/591300/1","author":{"@type":"Person","name":"alexrossi","url":"https://community.spiceworks.com/u/alexrossi"}},{"@type":"Answer","text":"
<\/p>","upvoteCount":0,"datePublished":"2017-07-04T16:45:57.000Z","url":"https://community.spiceworks.com/t/get-mailbox-size-from-csv-exchange-online/591300/2","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
#Thank you, will do.\n\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2017-07-04T16:51:54.000Z","url":"https://community.spiceworks.com/t/get-mailbox-size-from-csv-exchange-online/591300/3","author":{"@type":"Person","name":"alexrossi","url":"https://community.spiceworks.com/u/alexrossi"}},{"@type":"Answer","text":"