Exchange 2007 Administrative Scripts
Ongoing     Case # 10034     Affiliated Job:  New Trier Township District 2031
Opened:  Thursday, May 6, 2010     Closed:  N/A
Total Hit Count:  21287     Last Hit:  Monday, October 16, 2017 8:33:24 PM
Unique Hit Count:  3816     Last Unique Hit:  Monday, October 16, 2017 8:33:24 PM
Case Type(s):  Server, Development
Case Notes(s):  All cases are posted for review purposes only. Any implementations should be performed at your own risk.

Request:
By request I will frequently research out some scripts or batches I can run to automate or extract information out of the Information store about user/mailbox accounts. This is just a glimpse into some of the useful ones I have come across.

Action(s) Performed:
Total Action(s): 4
Action # Recorded Date Type Hit(s) User Expand Details
10122 5/6/2010 12:08:00 PM Server 1833 contact@danieljchu.com Mailbox Sizes This process builds a listing of mailbox sizes base  Collapse ...
Last Hit: Monday, October 16, 2017 8:06:00 PM

Mailbox Sizes

This process builds a listing of mailbox sizes based on a query from A.D. - such as Administrative, Staff, Faculty etc - and pushes these results into a text file which is then emailed out to a defined set of recipients. This can be a useful script if you wish to automate statistical findings through scheduled task and with some slight revisions can offer other details about an Exchange environment.

-   Download the MailboxSizes.bat & MailboxSizes.ps1 files
-   In both these files you will need to adjust the information accordingly
-   The MailboxSizes.bat simply calls Windows PowerShell, loads the ExShell followed by initiating the MailboxSizes.ps1 script
   o   Adjust the path to both the ExShell.psc1 & MailboxSizes.ps1 files
-   For the MailboxSizes.ps1 file, you will need to go through the script and edit the following:
   o   Variables at the beginning
       
   - $FromAddress = "postmaster@somedomain.com"
   - $ToAddress = "recipientemail@somedomain.com"
   - $MessageSubject = "Mailbox Size Report"
   - $MessageBody = "Attached is the current list of mailbox sizes."
   - $SendingServer = "smtp.somedomain.com"
   o   Followed by the query into Get-Mailbox or A.D. query, whichever better suits your needs, you can use multiple if you wish
       
   - Example of a Get-Mailbox Query might be
         + Get-Mailbox -resultsize unlimited | where-object {$_.Office -eq "Chicago"} | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending |
           ft DisplayName,@{label="TotalItemSize(KB)";expression={$_.TotalItemSize.Value.ToKB()}}, ItemCount, storagelimitstatus > chi-mailboxes.txt
   - Example of a A.D. Query might be
         + query-ad "(&(|(msExchRecipientTypeDetails=1)(msExchRecipientTypeDetails=2)(msExchRecipientTypeDetails=4)
           (msExchRecipientTypeDetails=8)(msExchRecipientTypeDetails=16)(msExchRecipientTypeDetails=32))(|(description=Administration)
           (description=Management)))" "distinguishedname" | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending |
           ft DisplayName,@{label="TotalItemSize(KB)";expression={$_.TotalItemSize.Value.ToKB()}}, ItemCount, storagelimitstatus
           > mangadmin-mailboxes.txt
   - Example of a specific user
         + Get-User DoeJ |Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(KB)";
           expression={$_.TotalItemSize.Value.ToKB()}}, ItemCount, storagelimitstatus > JohnDoe-mailbox.txt
   o   Finally the location & names of the attachments
       
   - $Attachment = New-Object Net.Mail.Attachment("./chi-mailboxes.txt ")
   - $Attachment02 = New-Object Net.Mail.Attachment("./mangadmin-mailboxes.txt ")
   - $Attachment03 = New-Object Net.Mail.Attachment("./JohnDoe-mailbox.txt ")
10128 5/6/2010 12:07:00 PM Server 1506 contact@danieljchu.com Enabling Open Relay in Exchange 2007 Occasionally there will be t  More ...
10123 5/6/2010 12:06:00 PM Server 1534 contact@danieljchu.com Disconnected mailboxes not being displayed A simple way to see th  More ...
10124 5/6/2010 12:05:00 PM Server 1548 contact@danieljchu.com Mass Update to Mailbox Permissions Simply by using the pipe "|" b  More ...



Profile IMG: Footer Left Profile IMG: Footer Right