Skip to main content

Posts

Show Users last Message Sent and Received Times,Subject in a Form using Powershell against Exchange 2007 Message Tracking Logs

In the past I’ve written and shown many ways to use Message tracking Log data in Exchange 2000-2003 using the WMI MessageTrackingLog class. With Exchange 2007 the WMI class is now gone replaced with a new Exchange Management Shell Powershell cmdlet. Although losing the richness of WQL is a little bit of shame the new cmdlet is pretty funky especially the little status bar (that’s gold). Message Tracking Logs can have many uses none more so then showing you current mailbox activity like who is actively sending and receiving mail in the last X number of minutes which may be important to you if you are working late at night on a server and you need to know who is active. This is my first go at a messagetracking log script for 2007 and I must admit I’m lacking some good load data at the moment for Exchange 2007. What this script does is creates a winform with a few Date and Time controls and populates a Drop down box with the names of the Exchange servers within an Exchange organiz...

Turning on Filter Junk Email in Exchange 2007 via an OWA Script

In the past I’ve posted a few scripts for setting and reading the OWA junk email filter settings here . While content filtering and the IMF have changed in Exchange 2007 there are still no cmdlets that will allow you to flip this option on or off for users so this little script still can come in handy for various situations. Because OWA was rewritten from the ground up in Exchange 2007 the old script method no longer works. However the same methods of reverse engineering the OWA method do work with a few additions. Using the MSXML2.ServerXMLHTTP.6.0 object this object is included with the Microsoft XML Parser (MSXML) and is a better choice for this script because it firstly supports the ability to ignore any SSL errors that might happen (eg self signed Certs, Alternate names etc) and it also handles dealing with the Forms Based Authentication cookie without the necessity to add additional code. The code still needs to perform the synthetic forms logon this works similar to 2003 with a ...

Setting the Homepage on a Outlook Folder via a script

I’ve had a number of people ask this question in the past so I thought I’d post up a script to help out those they may want to look at doing this. When you set the Outlook homepage within Outlook it configures the PR_FOLDER_WEBVIEWINFO or http://schemas.microsoft.com/mapi/proptag/0x36DF0102 property. This property is a Binary property who’s format is undocumented but using a Mapi editor like OutlookSpy or MfcMapi you can work out the format that this follows. The basic format is dwVersion: 0x00000002 dwType: 0x00000001 dwFlags: 0x00000001 dwUnused: 0x0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 cbData: 0x188 (000000BC) bData: http://yoururl.com If you want to set this property in a script the 3 values you need to worry about are dwFlags If this is set to 1 then the check box in Outlook for “Show homepage by default for this folder” will be checked. cbData is the number of b...

Synconize items from a public folder to a mailbox folder with WebDAV replication

A while ago I wrote this script to synchronize contacts from a mailbox folder to a central contacts folder using Webdav replication and CDO 1.2 as the copy mechanism. A few people have asked about going the other way eg from a central contacts folder or calendar folder to a local mailbox folder so I've managed to find a bit of time this week to create a port that would do this. The underlying functionality of how this work is written up in the other post so i won't repeat this the main points with the new script are There are four scripts in the download like the previous post there is both FBA and NTLM/Basic version to cater for different authentication. Theres also a separate version for contacts/mail objects and calendar objects. The main differences with the calendar version is that as well as copying the calendar item to the target folder it changes the colour of the appointment to blue and also sets the freebusy status of this appointment to FREE. The following lines are...

Testing SMTP verbs and sending an alert based on the SMTP reply code

I had an interesting problem with a SMTP gateway this week because one of its internal processes had failed the server was processing mail down to the TO verb in the SMTP Protocol exchange and then failing with a specific Status code. Usually you could detect this type of fault by looking at growing queue sizes or delayed delivery times but I wanted a solution that would go out and proactively check the SMTP verbs on a mail server so I could make sure that I would be alerted if there was any issue with anything going on in the SMTP stack. A while ago I posted a SMTP test script for Powershell which simulated a telnet test against port 25 using Powershell. Using this as a base I streamlined the code to stop outputting information to the commandline and added some logic to parse the first 3 characters from the exchange SMTP response which will relate to the SMTP status code. If everything is going well with your SMTP box you should get a 250 status code see for a full list of stat...

Using Exchange Web Services to create appointments in the Google Calendar using the Google Calendar API

I’ve being playing around with some code over the last couple of months for synchronizing an Exchange calendar with a Google Calendar using a SyncFolderItems operation on the EWS Side to get a list of updates from a calendar and using the Google .NET client library to create the appointments in a Google calendar. I did manage to successfully create something that was able to create appointments in the Google calendar based on the EWS output. I even got recurring events working by building some logic that converted the recurring output types that EWS uses into a RRULE that could be used in the Google calendar. But when I sat down to look at the rest of the synchronization logic I would need to write to get exceptions to recurring appointments,updates and deletes working the motivation to do this wasn’t really there so instead of just committing this to the back burner I thought I’d post the code which might help someone else out. The EWS SyncFolderItems operation is very similar t...

Reporting on Mailbox sizes and counts for the Deleted-Items (or any other folder in a mailbox) for all users on a Server

Here’s one more use for an adaption of the mailbox age script I posted a while ago the mailbox manager is a great tool for enforcing age limits on mailbox folders if you would like some reporting outside of what the mailbox manager produces on folders that you intended to implement age restrictions on then this script may help. Before running this script you need to set 2 variables in the code the first is the number of days you want this script to report on. Eg if you set it to 7 days it will produce a report of the number of items and size of those items in the folder you configure in the next variable that are under 7 days old and those that are over 7 days old. The second variable that needs to be set is the folder you want to run against by default its set to the deleted items folder. numbdays = 7 folderurl = "/Deleted Items/" By default the script doesn’t re-curse sub folders within the folder you configure if you want this to happen you need to unrem the followi...
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.