thelink12
asked on
Export size of the "Sent" folder and "Deleted" folder in of all mailboxes in Exchange 2010 to Excel
I have an exchange script that I want to export the size of the sent folder and deleted folder for ALL mailboxes in the environment. Exchange 2010. I have tried this...
foreach($mbx in Get-Mailbox){
Get-MailboxFolderStatistic s $mbx.identity -FolderScope deleteditems | select @{n="DisplayName";e={$mbx. displayNam e}},Folder Path,Items InFolder,F olderSize
Get-MailboxFolderStatistic s $mbx.identity -FolderScope sentitems | select @{n="DisplayName";e={$mbx. displayNam e}},Folder Path,Items InFolder,F olderSize
}
and it seems to display everything on the screen fine. What I want it to do is to export it to an excel spreadsheet so I can manipulate it. I tried adding |export-csv but it didnt work. It creates the .csv files but they are empty.
foreach($mbx in Get-Mailbox){ Get-MailboxFolderStatistic s $mbx.identity -FolderScope deleteditems | select @{n="DisplayName";e={$mbx. displayNam e}},Folder Path,Items InFolder,F olderSize | export-csv c:\deleted.csv
Get-MailboxFolderStatistic s $mbx.identity -FolderScope sentitems | select @{n="DisplayName";e={$mbx. displayNam e}},Folder Path,Items InFolder,F olderSize |
export-csv c:\sent.csv
}
I know this has to be easy, I just dont know what I am doing.
foreach($mbx in Get-Mailbox){
Get-MailboxFolderStatistic
Get-MailboxFolderStatistic
}
and it seems to display everything on the screen fine. What I want it to do is to export it to an excel spreadsheet so I can manipulate it. I tried adding |export-csv but it didnt work. It creates the .csv files but they are empty.
foreach($mbx in Get-Mailbox){ Get-MailboxFolderStatistic
Get-MailboxFolderStatistic
export-csv c:\sent.csv
}
I know this has to be easy, I just dont know what I am doing.
ASKER
I am still not getting the correct output. I ran the attached script from powershell on my workstation. I watched the file get created and then I saw the size of the file fluctuate between 0 and 3 KB until the script was finally done and the attached excel document was what I got. I apologize, I really know little about powershell.
exchang3.txt
temp.csv
exchang3.txt
temp.csv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Definite progress. If I run this as it is written, I see the sent items in the console and the deleted items are exported to a file. If I switch replace "deleteditems" with "sentitems" and vice versa the output switches. Deleted items to the console and sent items to the text file. Is it easy to encorporate an age range in the sent items? Say 180 days?
Nothing coming to my mind as of now :(
- Rancy
- Rancy
ASKER
This is a great start and I can tweak it as needed.
If you got that 180 days and can share maybe can help and many others in the future :)
- Rancy
- Rancy
Get-MailboxFolderStatistic
Get-MailboxFolderStatistic
or ever | Out-File C:\Output.csv
- Rancy