forsters
asked on
Powershell script to count number of Mailbox folders in Exchange 2010
Hi Experts
I have a simple script that will tell me the number of folders in a users mailbox here:
(get-mailboxfolderstatisti cs -id %username%).count
Is there anyway to amend this or does anyone have a script that will list all users on the Exchange server and the number of folders each has.
Many thanks
Forsters
I have a simple script that will tell me the number of folders in a users mailbox here:
(get-mailboxfolderstatisti
Is there anyway to amend this or does anyone have a script that will list all users on the Exchange server and the number of folders each has.
Many thanks
Forsters
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
We can use something like the script I posted here:
https://www.experts-exchange.com/questions/27479690/Piping-multiple-cmdlets-into-a-single-CSV-file.html?cid=1131&anchorAnswerId=37242149#a37242149
https://www.experts-exchange.com/questions/27479690/Piping-multiple-cmdlets-into-a-single-CSV-file.html?cid=1131&anchorAnswerId=37242149#a37242149
$Mailboxes = Get-Mailbox -ResultSize unlimited
$Output = @()
foreach ($Mailbox in $Mailboxes){
$MailboxStatistics = $Mailbox | Get-MailboxStatistics
$FolderStatistics = $Mailbox | Get-MailboxFolderStatistics
$objUser = New-Object System.Object
$objUser | Add-Member -MemberType NoteProperty -Name "Name" -Value $Mailbox.Name
$objUser | Add-Member -MemberType NoteProperty -Name "SamAccountName" -Value $Mailbox.SamAccountName
$objUser | Add-Member -MemberType NoteProperty -Name "FolderCount" -Value $FolderStatistics.count
$objUser | Add-Member -MemberType NoteProperty -Name "ItemCount" -Value $MailboxStatistics.ItemCount
$objUser | Add-Member -MemberType NoteProperty -Name "TotalItemSize" -Value $MailboxStatistics.TotalItemSize.value.ToMB()
$Output += $objUser
}
$Output | Select-Object Name,SamAccountName,FolderCount,ItemCount,TotalItemSize | Export-CSV "Output.csv"
ASKER
Thanks both
Dnesse I could not manipulate your script to work although it is a useful script so thanks
Thomas-Mjelde your script worked perfectly. Many thanks
Dnesse I could not manipulate your script to work although it is a useful script so thanks
Thomas-Mjelde your script worked perfectly. Many thanks
Get-MailboxStatistics -server SERVERNAME| Sort-Object TotalItemSize –Descending | ft DisplayName,TotalItemSize,
you should be able to incorporate your script into this?