Skip to main content


Showing posts from 2008

FreeBusy In/Out Board for Exchange 2007 using EWS and Powershell

Update version see here Firstly this isn't a new idea there's been a similar script on CDO live for years that uses CDO 1.2. I've had a couple of people ask about doing this in Powershell and EWS using the new availability service on 2007 so here it is. How does it work To get the Free/Busy status of another mailbox in Exchange you need to make use of the getuseravailability operation in EWS. To be able to query another users availability you must have been granted rights to the free/busy information for that users Mailbox by default the default ACL gives users the right to see Free/Busy availability but not the newer Subject and Location information made available in 2007. To change the default Free/Busy Permission you can use something like this post A more granular approach would be to assign these rights to a specific user or group eg something like this would add a group to calendar if it didn't exist [void][Reflection.Assemb

Importing and Synchronizing Contacts from a CSV (Outlook Express Export) into Exchange 2007 (private Contacts Folder or Public Contacts Folder) using

Following on from last week I’m going to put the Sync function I created into use and also show you how to create a contact in Powershell with a few lines of code using some wrappered EWS code I’ve put into my EWSUtil powershell library. I’ve also include some code to create a grouped list of contacst flagged with a custom property to allow full sync eg create if don’t exist create , delete if deleted from the syncfile and do property level changes if phone, address of name information is modified. I’ve used a csv file generated by doing an export in Outlook Express but this could be any csv file from any source. Before we can use this process we need to set the target folder to where the contacts will be imported to or where the contacts we are going to sync with are located. For a local users contact folder something like this is needed. $lcLocalContactFolderid = new-object EWSUtil.EWS.DistinguishedFolderIdType $lcLocalContactFolderid .Id = [EWSUtil.EWS.DistinguishedFolderIdN

Syncronizing contacts in Exchange 2007 with other things - helper class

Copying a Contact in Exchange is one thing synchronizing is another this can be one of the great contradictions and issues that faces anybody looking at synchronizing contacts between different storage mediums. Whether that be a Database, CSV file or other Mail System underlying its the same information stored and accessed in a different way. Because Exchange isn't your normal flat file database more a relatively complex property store that uses some complex datatypes doing property level synchronization does provide a unique set of challenges. Exchange Web Service presents some of these properties in more workable format but apart from this doesn't give a lot of help is solving this fundamental issue. The SyncFolderItem and notification operations only provide an Item level ability to spot changes on an item so the brave souls who want to embark on a greater level of synchronization must take this challenge unto themselves. If your going to compare two contacts it first helps

Find Unused Mailbox Powershell Gui Exchange 2007

** If your using Exchange 2010 see ** Finding unused mailboxes is one of those mind numbing tasks a Sys Admin must perform routinely in Large Exchange organizations. Many of the scripts on this blog help to show ways to tackle different issues around unused or disabled mailboxes such as removing disabled users accounts from groups or finding broken delegate forwarding rules etc. I've also posted a few scripts before that showed some methods to track down unused mailboxes by looking at the number of unread email and the last time a mailbox sent a message. Well this script puts some of these methods together in a powershell GUI script that uses Exchange Web Services and some Exchange Management Shell cmdlets to look at all mailboxes on a server and show us information about when a mailbox was logged into, how big it is, how many unread email there is and when the last sent and/or received email was.

Dealing with Non Delivery Reports with Exchange Web Services

If there was one thing i would change if I could redesign email from the ground up it would have to be NDR's. While these delivery reports are functional in what they do from a user and even an administrative prospective they are horribly disfunctional. While there isn't much you can do around the underlying design of NDR's with a little help from your favourite Exchange API there are certain tasks that can be made more livable. NDR Overload If your users are sending and receiving a lot of email they you'll probably find that a number of NDR's are being generated for a vast number of different reasons. A lot of the times the loop will get closed where your user having tryed and failed to decipher what the NDR says gives up and calls the helpdesk. If your sending a copy of NDR's to a central mailbox what can be usefull for everybody concerned is to have a digest list of all the NDR's that have been recieved in a certain time frame this can allow you to do

Vb.NET sample for getting the number of Unread messages from an inbox using Impersonation with Exchange Web Services

Although im not a great user of VB any more there does seem to be a bit of a dirth of samples for those people who haven't made the leap to using C#. So here's something that might fill the void for a few people I've put a donwload of this code here the code itself looks like Imports ewsvbsamp.ews Imports System.Net Imports System.Net.Security Imports System.Security.Cryptography.X509Certificates Module Module1 Sub Main() Console.WriteLine(GetUnreadEmailCount("")) End Sub Public Function GetUnreadEmailCount(ByVal emailaddress As String) As Integer Dim UnreadCount As Integer = 0 ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateCertificate) Dim esb As New ExchangeServiceBinding esb.RequestServerVersionValue = New RequestServerVersion esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1 esb.Crede

WebService to release Quarantined messages in Exchange 2007

This post follows on from the quarantine digest message post last month and looks at the challeges around resubmitting a Quarantined message. Outlook 2007 and OWA 2007 have the ability to resend a message from the Quarantine mailbox using the Resend facilities that are documented in . Unfortunately you can't do this using Exchange Web Services because EWS doesn't give you full access to to the recipient collection so this means its not possible to set the PR_RECIPIENT_TYPE for each recipient you want the message delivered to and to also mark those message recipients you dont want the message delivered to. One interesting piece of functionality the quarantine mailbox has is the ability to sendas any email address be it Internal or External eg all you need to do is set the following Mapi property on the message your sending and this will become the sender of the message when you send it. Note this will only work for

Exchange Reverse Permission audit Powershell Gui version 2 Exchange 2007

This script builds on a script I posted earlier in the year that produced a GUI that showed permissions and reverse permissions for Exchange Mailboxes (eg what other mailboxes a particular mailbox has access to). The previous version just looked at the Mailbox Rights and Send AS/Receive AS rights. This new version using Exchange Web Services looks at firstly the rights on the shared folders in a mailbox (eg Root,calendar,inbox,notes,task,journal) and also the Outlook Delegates and the rights assigned to the delegates such as Private Items access and Meeting recipients as well as all the other permissions it did previously. Sorry i haven't got the snapshot functionality done yet which i think i promised before but... The cool thing is this script now lets us answer a bunch of new questions such as Which users have given acess to paricular folders in their Mailbox to other people(including the default user which may mean the have unwillingly delegated access to everyone). And we ca

WizBang Exchange 2007 Message Tracking Powershell Gui Version 1

Unlocking the secrets from the depths of the Message Tracking Logs is an ever recurring theme on this blog and in general an important area of Exchange Server Management. In this latest incarnation we boldly go where no Message Tracking application has gone before as well as the normal aggregation, graphing and exports bits and pieces. The new functionality this script introduces expands on post I was talking about a couple of weeks ago which is Using Exchange Web Services to Enhance Exchange Message Tracking . So what we end up is a GUI that does aggregation and filtering and then the ability to look at the content of a particular message by using EWS to find the message based on its message-ID and then being able to see the Subject,Body and then export attachments or the whole message as an EML file. As this is version one i haven't quite go around to making the message search do a Deleted Item Scan (Dumpster Dive) and there is also an issue with Sent Items where the Clients i

Adding Entries to the Safe Sender,Safe Recipients and Blocked Senders in Exchange 2007 via a script workaround

The following is an extension to the Junk Mail enable script for 2007 i posted here . Using the same OWA automation workaround this extends the ability of this script to also add entries to the Safe Senders, Safe Recipients and Blocked Sender by re-using the cmds from OWA 2007. To add these entires the following XML is posted to /ev.owa?oeh=1&ns=JunkEmail&ev=Add <params><iLT>1</iLT><sNE>" & emEmailAddress & "</sNE><fFrmOpt>1</fFrmOpt></params> The <iLT>1</iLT> is the only things that changes eg <iLT>0</iLT> Adds to Safe Senders <iLT>1</iLT> Adds to Safe Recipients <iLT>2</iLT> Adds to Blocked Senders Make sure you read the original post I've linked above which documents the objects used and the potential issue around using this type of method which is just a quick workaround. I've put a download of this script here the code looks like snServername = "

Setting the OWA themeid via a script in Exchange 2007

This is a workaround for lack of the ability to set the OWA themeid programatically for those interested in the Technical side this setting is held in a FAI Message with a message class of "IPM.Configuration.OWA.UserOptions" in the Non_IPM_subtree of a mailbox. The setting is held as part of XML string in the 0x7C070102 binary mapi property on this item. Because there is no documentation for the structure of this property it makes setting and reverse engineering this risky and potentially error prone. One realtivly easy workaround to do this is to use some OWA automation code to use the method OWA uses to set this property. I've used this type of thing before to enable junkemail filtering on 2007 in OWA see 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 e
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.