Le Café Central de Deva
let.us.share.develop.more... Deva blogs!!
One of my customer automated Exchange PowerShell with his .Net application. They had a requirement to enhance the functionality – to get the list of exchange mailboxes, folders and its sub folders, items in folder, foldersize. Finally it needs to be saved in .csv format. To implement this, we used Get-Mailbox and Get-MailboxFolderStatistics Exchange cmdlets. For looping the objects, we used foreach-object and couple of pipes to achieve the goal.
PowerShell (screenshot):
PowerShell (script) – adding for your reference:
[PS] C:\Documents and Settings\Administrator>Get-Mailbox | Select-Object alias | foreach-object {Get-MailboxFolderStatistics -Identity $_.alias | select-object Identity, ItemsInFolder, FolderSize} | Export-csv c:\Stats.csv -NoTypeInformation
Result:
As you know you can automate your application using .Net programmatically by referring the following articles:http://msdn.microsoft.com/en-us/library/bb332449(v=exchg.80).aspx and http://msdn.microsoft.com/en-us/library/ff326159(v=exchg.140).aspx.
Happy programming!!