Adding Outbox size to a mailbox report

by toybits at 2013-01-25 01:24:29

Hi

I’m trying to add the outbox size of the below script to my report. We’re going through a mailbox quota rationalisation project. This just reports on a list of mailboxes given to me.

It’s pretty much working except of the commented out Outbox line. I need to get outbox size for an issue we’re experiencing. Can anyone help get that to work. Also I’m pretty new to PS so any constructive criticism would be greatly received on the rest of the way I’ve done the script.

$mb = Get-Content c:\Temp\MBQuotaUpdates.txt | Get-Mailbox
$mb | Select-Object name,alias,servername,ProhibitSendQuota,IssueWarningQuota,DisplayName,
Database,PrimarySmtpAddress,ProhibitSendReceiveQuota,UseDatabaseQuotaDefaults,
@{n="Size(MB)";e = {$MBXstat = Get-MailboxStatistics $.name; $MBXstat.totalItemsize.Value.ToMB()}},
@{n="Items"; e = {$MBXstat = Get-MailboxStatistics $
.name ; $MBXstat.itemcount; $MBXstat.storageLimitStatus}} |
# @{n="OutboxSize"; e = {$MBOutboxSize = $.Name | Get-MailboxFolderStatistics -FolderScope "Outbox" ; $MBOutboxSize.FolderSize}} |
Export-Csv -NoTypeInformation c:\Temp\ukmbxtemp.csv


Thanks in advance for any assistance.
by Takuu at 2013-01-25 13:21:42
Hi toybits,
It looks like you are trying to pipe the Name property into Get-MailboxFolderStatistics. Not all PS functions accept pipeline input. You will want to use the -Identity parameter, and as far as what you are giving that parameter, I would personally choose the Alias property of your mailbox object, but Name will work as well.

Instead of creating the $MBOutboxSize variable each time and just piping it along, you will just give the Get-MailboxFolderStatistics cmdlet the data.
@{n="OutboxSize"; e = {$MBOutboxSize = $
.Name | Get-MailboxFolderStatistics -FolderScope "Outbox" ; $MBOutboxSize.FolderSize}}

@{n="OutboxSize"; e = {Get-MailboxFolderStatistics -Identity $_.Name -FolderScope "Outbox" ; $MBOutboxSize.FolderSize}}

That should do you fine.

For the additional info… The identity parameter of Get-MailboxFolderStatistics accepts:
GUID, ADObjectID, DN, Domain\Account, UPN, LegacyExchangeDN, SMTP address, or alias.

Most of what you need to know about the functions are available in the powershell help files.
Get-Help Get-MailboxFolderStatistics (along with the -full, -detailed, or -examples switches) and start browsing! For the syntax part of the help, anything that is in square brackets is an optional parameter, and if it has a "<value>" as the accepted input for a parameter, that means you can put an array or a collection of objects into that parameter and it’ll take care of the rest.

Good luck!
by nate-n8 at 2013-01-28 07:37:03
Toybits,

I’m curious what your issue with the outbox is as I too might be having the same issue. I discovered this issue when a user received a warning for their mail quota. They questioned why they received it because all their mail folders were pretty much cleared out. When I ran the get-mailboxfolderstatistics against their mailbox, I saw there was over 1000 items in their outbox unbeknowst to the user. So I ran the same cmd against everyone and found there are 100+ users that have over 100 emails in the outbox. It looks like these emails were sent but failed to move itself to the sent items. If this is the same issue your having, I’d like to know how your going to address it.
by toybits at 2013-01-31 02:10:53
@Takuu Thanks for the reply I’m going to give that a try today.

@nate-n8 Yep sounds like you have the same issue as us.

We had a lot of users reporting that they had reached quotas but couldn’t see it in their mailbox. We’re trying to find a common denominator.

What we have so far is:-

1. It affects Outlook 2007 and 2010 users.
2. A lot of them seem to be PGP users as well. We have a lot of users who have secure email requirements.
3. All our users run in Cached Exchange Mode.

Blog post really describes the problem well for us.

http://panerarichang.blogspot.co.uk/201 … itens.html

We have a couple of desktop people looking at the issue and I’m looking at the server side so once we work out what’s going on I’ll post what we find.
by Takuu at 2013-01-31 11:49:11
Sure thing toybits, anything I can do to help. I’m learning more and more about Powershell everyday and I thought this would be a good way for me to get more exposure to issues and some new techniques. You know… rather than writing scripts to clean up our environment LOL.

On a related side-note, I actually just got a ticket last week about a user who has messages in the Outbox and is running Outlook 2010 (Exchange 2007 env) and cached mode. I’ll be watching here for any developments and post any findings I get.
by nate-n8 at 2013-01-31 13:51:16
For us, it seems to be users running Outlook 2007 and 2010 in cached mode. I cannot find anything in common with the actual emails in their outbox.

I actually have a case open with M$ on this issue and nothing so far
by toybits at 2013-02-13 01:33:24
Thanks Takuu that worked.

If we get anywhere with the Outbox issue I’ll post a reply.

We’re trying to get the Desktop one of the Desktop teams in one of our buildings to install an Outlook patch so will come back to you when they try.
by nate-n8 at 2013-02-23 21:58:20
So M$ suggested using the SendOne reg fix, but havent tried it out yet. But I’m also considering setting a retention policy on the Outbox.

For now, I’ve been using these EWS scripts to bind to the Outbox folder and remove the messages.
http://www.mikepfeiffer.net/2011/04/powershell-script-cmdlets-for-managing-e-mail-items-using-the-exchange-web-services-managed-api/
by Takuu at 2013-02-25 06:39:06
Thanks for the response nate-n8. I’ll check that out. Users have either stopped experiencing the issue or quit reporting it for us (for now).