As a fun scripting project, I thought it would be beneficial to create an Event Log Matrix of sorts that displayed Windows Server application and system errors and warnings by count and error message on a simple HTML page using PowerShell. The below script dumps the top 5 errors per server, along with the error count, Event ID, Error Type and the event message for the last 2 hours. This is a great tool for daily system checks.
While migrating mailboxes from Exchange 2003 to Exchange 2010, I wanted to get periodic email updates on the mailbox move status. Below is a quick Exchange PowerShell script to do this work. (I am sure it can be improved greatly, but it served as a quick fix to my need)
The script: Save this file as Get-MOVE-STATUS.ps1 in your C:\Scripts folder. (CAS server works best)
Note: If you want to automate this, save the above PowerShell Script as Get-MOVE-STATUS.ps1 and then create a batch file with the below text. You can then create a scheduled task calling the batch file with whatever time iterations you need. (Be sure to run it as “elevated” or highest privileges and as an account that has access to Exchange servers)
Best of luck!
How much overhead is there in Exchange 2010 with regard to mailbox content and storage consumption in the Junk Email and Deleted Items folders? This topic often comes up as expensive SANs and Storage arrays fill up, especially with thin-provisioned storage arrays, such as Equallogic designs for Exchange.
There are 2 main topics that I wanted to check on each Exchange 2007 Mailbox Server:
- How much data is stored in the Deleted Items Folder
- How much data is stored in the Junk E-Mail Folder
My experience has shown that 10-15% of your overall Exchange data is located in one of these two folders if your organization does not institute some type managed folder or retention policy in your Exchange organization.
I have written a script to pull the Mailbox size, Deleted Items, and Junk Email Size out of Exchange. For large Exchange organizations, this script could take some time to run. The script dumps all of the data to an Excel spreadsheet that is then emailed to the email administrator. At the end of the script you will have to define the Recipient, Sender and SMTP server.
Out-Put is dumped to Excel:
Remedial Actions on cleaning up this data within Exchange:
- We can create Exchange 2007 Managed Folder Policies or Exchange 2010 Retention Policy Tags, meaning we auto-purge items in specific folders.
- We can adjust how long the Deleted Items or Dumpster is preserved
- We can adjust the DIRT (Deleted Item Retention Time) and DMRT (Deleted Mailbox Retention Time)
- We can adjust quotas and nag limits on usersdatabases
Update: I just recently added a “Managed Folder” query as well, which is defined as part of your Managed Folder or Item Retention Policy.
This is one of the more handy scripts I have put together. It enumerates both the Active Directory and Exchange mailbox data\statistics and sends them to an administrator’s email account, in a nicely formatted message.
Active Directory Information
Exchange Mailbox Statistics
Safe Senders List
Exchange Logon Statistics
Exchange ActiveSync\Mobile Device Info
I am still working on the syntax for the Safe Senders list…..
Usage: Run the script and pass it two variables at the prompts:
- The alias of the mailbox you want to dump
- The Email address of the person you want to send the report
Best of luck,
I decided to work on an Exchange 2010 PowerShell, HTML Status page script that would dump the following Exchange 2010 Mailbox information statistics:
- Exchange Mailbox and Distribution List counts per domain
- Total Exchange Mailbox Count, with averages and totals of Mailbox size and content
- Total number of Databases with raw storage used, averages, and max and min DB sizes
- The script: Save the script below as
The Output: Nice and organized HTML Page
If you want to automate this and archive the HTML file each day, you can create a batch file and call the PowerShell script using a scheduled task.
Best of luck!
Taken from Microsoft’s Exchange Team Blog and modified, we have been able to take two SQL scripts, run them against our Front-end Protocol servers, and retrieve usage data pertaining to Active Sync users and clients. The first script produces a ‘Hits by User’ Report which will show you which users are hitting your EAS servers. This report provides many of the statistics that could help you better understand how your users are interacting with your EAS deployment. It returns information by individual user such as, devices type used, number of Syncs, Emails Sent, Attachments downloaded, Meeting Responses, etc.
The second script produces is a ‘Hits by DeviceType’ Report. This report gives you a breakdown of the DeviceTypes (SmartPhone, PocketPC, etc.)
You need several things setup in order for the scripts to work:
- Install Microsoft’s LogParser 2.2 or later on your Front-End Exchange server(Get it here)
- Copy both SQL scripts to the "C:\Program Files\Log Parser 2.2" directory on your Front-End Exchange server. If you have more than one server, this will need to be ran on every Front-end server n your organization to get accurate results. (IIS logs are being parsed)
- Get the scripts. Script 1 (Save as Hits_By_User.Sql) and Script 2 (Save as Hits_by_DeviceType.Sql). (Email Me for the scripts)
Once saved, open a command prompt to "C:\Program Files\Log Parser 2.2" from your Front-End Exchange server.
Issue this command: LogParser.exe -i:IISW3C file:"C:\Program Files\Log Parser 2.2\Hits_By_User.sql"
This is going to create a file named Hits_By_User.csv in the root of C:\. Depending on your usage the script may take 15-30 minutes to run.
Once complete, open a command prompt to "C:\Program Files\Log Parser 2.2" from your Front-End Exchange server.
Issue this command: LogParser.exe -i:IISW3C file:"C:\Program Files\Log Parser 2.2\Hits_By_DeviceType.sql"
This is going to create a file named Hits_By_DeviceType.csv in the root of C:\. Depending on your usage the script may take 15-30 minutes to run.
Results should look similar to this: (By User)
, 60 *Other devices