Hello,
I have a script below that I want to use to get mailbox stats against my users in Exchange 2013, but I have an issue running it..
#$AllMailbox = Get-mailbox -resultsize unlimited
$AllMailbox = Get-mailbox -resultsize unlimited
Foreach($Mbx in $AllMailbox)
{
$Stats = Get-mailboxStatistics $Mbx.identity.distinguishedname
$userObj = New-Object PSObject
$userObj | Add-Member NoteProperty -Name "Display Name" -Value $mbx.displayname
$userObj | Add-Member NoteProperty -Name "Alias" -Value $Mbx.Alias
$userObj | Add-Member NoteProperty -Name "RecipientType" -Value $Mbx.RecipientType
$userObj | Add-Member NoteProperty -Name "Recipient OU" -Value $Mbx.OrganizationalUnit
$userObj | Add-Member NoteProperty -Name "Primary SMTP address" -Value $Mbx.PrimarySmtpAddress
$userObj | Add-Member NoteProperty -Name "Database" -Value $Stats.Database
$userObj | Add-Member NoteProperty -Name "ServerName" -Value $Stats.ServerName
$userObj | Add-Member NoteProperty -Name "TotalItemSize(MB)" -Value $Stats.TotalItemSize.value.ToMB()
$userObj | Add-Member NoteProperty -Name "ItemCount" -Value $Stats.ItemCount
$userObj | Add-Member NoteProperty -Name "DeletedItemCount" -Value $Stats.DeletedItemCount
$userObj | Add-Member NoteProperty -Name "TotalDeletedItemSize(MB)" -Value $Stats.TotalDeletedItemSize.value.ToMB()
$userObj | Add-Member NoteProperty -Name "DatabaseProhibitSendReceiveQuota" -Value $Stats.DatabaseProhibitSendReceiveQuota
$userObj | Add-Member NoteProperty -Name "LastLogonTime" -Value $Stats.LastLogonTime
$userObj | Add-Member NoteProperty -Name "MessageTableTotalSize(MB)" -Value $Stats.MessageTableTotalSize.value.ToMB()
$userObj | Add-Member NoteProperty -Name "MessageTableAvailableSize(MB)" -Value $Stats.MessageTableAvailableSize.value.ToMB()
$userObj | Add-Member NoteProperty -Name "AttachmentTableTotalSize(MB)" -Value $Stats.AttachmentTableTotalSize.value.ToMB()
$userObj | Add-Member NoteProperty -Name "AttachmentTableAvailableSize(MB)" -Value $Stats.AttachmentTableAvailableSize.value.ToMB()
$userObj | Add-Member NoteProperty -Name "OtherTablesTotalSize(MB)" -Value $Stats.OtherTablesTotalSize.value.ToMB()
$userObj | Add-Member NoteProperty -Name "OtherTablesAvailableSize(MB)" -Value $Stats.OtherTablesAvailableSize.value.ToMB()
$output += $UserObj
}
$output | Export-csv -Path C:\testing.csv -NoTypeInformationThe error I get is..
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At C:\OppyCheck\scripts\testing.ps1:32 char:1
+ $output += $UserObj
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Any idea why this is? What can I do to not get this error?