This is the modified script which is running faster than the script in the previous thread:
Code: Select all
$DataPath = "C:\TEMP\mbxresults.csv"
$Results = @()
$MailboxUsers = Get-Mailbox -ResultSize Unlimited
foreach($user in $mailboxusers) {
$UPN = $user.UserPrincipalName
$MbxStats = Get-MailboxStatistics $UPN
$UserNotes = Get-User $UPN
$Properties = @{
Name = $user.name
PrimarySmtpAddress = $user.PrimarySmtpAddress
UPN = $UPN
Alias = $user.alias
OU = $user.organizationalunit
Server = $MbxStats.servername
Database = $MbxStats.databasename
TotaItemSize = {$MbxStats.totalitemsize.Value.ToGB()}
Notes = $UserNotes.Notes
}
$Results += New-Object psobject -Property $properties
}
$Results | Sort-Object -Property TotaItemSize | Select-Object Name,UPN,Alias,OU,Server,Database,TotaItemSize,Notes | Export-Csv -notypeinformation -Path $DataPath
Excel column result:
Code: Select all
TotaItemSize
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
$MbxStats.totalitemsize.Value.ToMB()
...
$MbxStats.totalitemsize.Value.ToMB()
Any help would be greatly appreciated.