views:

108

answers:

1

I'm working on a .net application that needs interact with Exchange, specifically creating Exchange objects. Its a web based application, but will have a back end running as a service on the Exchange server.

I'm trying to decide the best way to interact with Exchange. My initial thoughts was to use powershell, with some sort of service queuing system for operations, however I'm worried this may make the application slow as some powershell operations can take some time. Would I be better of using HMC to do this, or is this essentially what HMC breaks down to anyway?

As far as I can tell there aren't any other options for interacting with Exchange, Exchange web services don't let you create higher level objects. I'm perfectly happy using powershell so long as its not going to become a big bottleneck, any alternative suggestions, or patterns to make this easier will be much appreciated.

+3  A: 

PowerShell can be a bottleneck, it you use the wrong idiom. Compare these three code samples

$ii=0;  0..10000 | % { $ii++ }; $ii
for ($ii=0;$ii -lt 10001;$ii++) { $sum+=$ii } ; $sum
0..10000 | measure-object -Sum

Using Measure-Command to get the execution time, the first takes 350ms, the second 74, and the third 28ms.

In general piping many objects in PowerShell isn't the fastest way to do something, but if your script is mostly about AD and COM calls, as in the case with Exchange, the limiting factor is unlikely to be PowerShell.

Scott Weinstein