Skip to main content


Showing posts from July, 2008

Show Exchange Whitespace / Retained Items and Deleted Mailbox Space in Powershell with flashy visuals

Each night most Exchange servers will run a scheduled maintenance operation which among other things does an online de-fragmentation of the Exchange Store, and removes deleted items and mailboxes that are past the stores configured retention periods. The result of these operations are logged to the event log with some interesting information about how much whitespace the online defrag operation recovered, the size of the retained items and retained deleted mailboxes remaining in the store. I've used these before in VBS here to do this in powershell is pretty easy. Lets jump into some code samples this is how you can get the whitepace in a Exchange store by querying the event logs via WMI for 1221 Event Log ids and then parsing the Size out of the event log message. $WmidtQueryDT = [System.Management.ManagementDateTimeConverter]::ToDmtfDateTime([DateTime]::UtcNow.AddDays(-3)) Get-WmiObject -computer servername -query ("Select * from Win32_NTLogEvent Where Logfile='Applica

Using Google Charts in Exchange Powershell Scripts

I've been looking at rewriting some message tracking scripts and one the things that's helpfull when you are doing message tracking is having some nice flashy visuals to help you out. Now there are some nice 3rd party packages out there like powergadgets who will separate you from your money and also the WPF framework stuff that give you some charting functionality. But if you want something that's free and will work from any workstation/server that has powershell and a Internet connection then its hard to go past Google Charts . Once you work you way around the different URL options its pretty much just a matter of creating some code to build the URL. So to put this into something that is actually useful here's a couple of samples that first generate Rate information from the message tracking log files on Exchange 2003 using the wonder of WMI and on Exchange 2007 using the Exchange Management Shell get-messagetrackinglog cmdlet. The script itself is pretty simple it u

Mail enabling a Public Folder using Exchange Web Services in Exchange 2007

A quick one from the mail bag if you are creating public folders using Exchange Web Services and you want these folders to be mail enalbed without needing to use the Exchange Management Shell or the Public Folder Management console in SP1. Then you can still do this using the same method that worked in Exchange 2000/3 by setting the following two Mapi properties PR_PUBLISH_IN_ADDRESS_BOOK = 0x3FE6000B PR_PF_PROXY_REQUIRED = 0x671F000B So in a CreateFolder Request you need something like CreateFolderType cfCreateFolder = new CreateFolderType(); PathToExtendedFieldType PR_PUBLISH_IN_ADDRESS_BOOK = new PathToExtendedFieldType(); PR_PUBLISH_IN_ADDRESS_BOOK.PropertyTag = "0x3FE6"; PR_PUBLISH_IN_ADDRESS_BOOK.PropertyType = MapiPropertyTypeType.Boolean; PathToExtendedFieldType PR_PF_PROXY_REQUIRED = new PathToExtendedFieldType(); PR_PF_PROXY_REQUIRED.PropertyTag = "0x671F"; PR_PF_PROXY_REQUIRED.PropertyType = MapiPropertyTypeType.Boolean; ExtendedPropertyType

Creating an RSS Feed from a calendar or inbox folder using Powershell with an EWS helper class

A number of years ago i posted some scripts to create RSS feeds from public folders and calendar folders using Exchange event sinks and some pretty simple VBS. These scripts where pretty simple and worked pretty well and I've still got some running today. On Exchange 2007 development technologies have moved on and so its time to move these scripts along as well. The big advantage is that with Powershell, .NET 2.0 and Exchange Web Services the flexibility or what you can do and therefore what you can then leverage with the newer advances in the .NET framework offer you a pretty nice sandpit to play in. The reality of this increase in flexibility is unfortunately an increase also in the complexity meaning that this reasonably simple VBS script becomes a little more complicated and while its possible to put together a script using SOAP strings it can be a pain to make this reusable and reliable in wide number of scenarios. To make this easier i've included the EWS routine's
All sample scripts and source code is provided by for illustrative purposes only. All examples are untested in different environments and therefore, I cannot guarantee or imply reliability, serviceability, or function of these programs.

All code contained herein is provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.