Send Mailbox Usage Figures by Email in Exchange 2007

I need to monitor the mailbox sizes of several group mailboxes in my Exchange 2007 environment, here’s a script that automates the process of sending out the mailbox sizes. Disk space is an issue on this server so the script also shows which mailboxes are taking up space because of the deleted items retention policy.

C:\WINDOWS\system32\WINDOW~2\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1” -Command “C:\SendStats\sendstats.ps1”

Contents of sendstats.ps1:

###Send mailbox statistics script

###First, the administrator must change the mail message values in this section
$FromAddress = “”
$ToAddress = “”
$MessageSubject = “Mailbox Size Report”
$MessageBody = “Attached is the current list of mailbox sizes and the retention dumpster sizes.”
$SendingServer = “”

###Now get the mailbox size stats and store in a text file
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label=”TotalItemSize(MB)”;expression={$_.TotalItemSize.Value.ToMB()}},ItemCount > mailbox_sizes.txt

###Get the Retained Item Sizes (Dumpster) and store in a 2nd text file
Get-MailboxStatistics | Sort-Object TotalDeletedItemSize -Descending | ft DisplayName,DeletedItemCount,@{label=”TotalDeletedItemSize(MB)”;expression={$_.TotalDeletedItemSize.Value.ToMB()}} > mailbox_retention_size.txt

###Create the mail message and add the statistics text file as an attachment
$SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress,
$MessageSubject, $MessageBody
$Attachment1 = New-Object Net.Mail.Attachment(“c:\sendstats\mailbox_sizes.txt”)
$Attachment2 = New-Object Net.Mail.Attachment(“c:\sendstats\mailbox_retention_size.txt”)

###Send the message
$SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer

Creating a Public Unattended Calendar in Exchange 2007

Creating and sharing a calendar in Exchange 2007 is the easy part, but allowing meetings to be created and automatically accepted requires the use of  the Exchange Powershell (where ResourceName is the name of the mailbox holding the calendar):

Set-MailboxCalendarSettings “ResourceName” -AutomateProcessing:Autoaccept

This will create the meetings when an appointment email is sent to the mailbox, but the titles of them will be blank. The subject of the email can be used instead:

Set-MailboxCalendarSettings “ResourceName” -DeleteSubject:$False

Finally assigning Full Access Permissions to the mailbox will allow users to view it without first creating a calendar entry, the same group of users will also be able to edit the entries. If it’s a calendar for everyone to use then assign the Everyone group full access.