Using–Filter, Select-Object, ForEach-Object in C# – Exchange PowerShell Automation

Have you ever tried migrating Exchange PowerShell script to be used from C# code?  I needed to convert the following script to C# Get-Mailbox -filter {ResourceType -ne "Room"}| Select-object Alias,DistinguishedName,Identity | foreach-object {Get-MailboxFolderStatistics $_.Alias} If you run the above script in Exchange 2010 Management Shell you might get the following error message: Pipeline not executed…


Searching contacts using EWS Managed API 1.1 from PowerShell (Impersonation, SearchFilterCollection, ContainsSubstring)

Here is another example of using EWS Managed API with PowerShell 2.0. In this case the requirement was to be able to find out all contacts that have Hotmail email address in any of the Email Address fields. This provided me to opportunity to demonstrate the use SearchFilterCollection and ContainsSubstring search filter from a PowerShell…


HOW TO: Migrating Exchange 2007 PowerShell Managed code to work with Exchange 2010

Will my Exchange 2007 PowerShell Managed code work with Exchange 2010 as is? Unfortunately the answer is NO, fortunately there are not many changes that you will have to make. The management experience given by Exchange 2010 through PowerShell has been moved all the way from Local to Remote. Dave Vespa has a detailed post…


HOW TO: Configure Exchange 2007 and Exchange 2010 for using Impersonation

Exchange 2010: Configuring Exchange Impersonation (Exchange Web Services) Using Exchange Impersonation XML Request/Response Using Impersonation in EWS Managed API Exchange 2007: Configuring Exchange Impersonation (Exchange Web Services) Using Exchange Impersonation (Exchange Web Services) ExchangeServiceBinding Class – Code Sample Enjoy!


HOW TO:Using Exchange Web Services Managed API 1.0 from PowerShell 2.0

Requirement: Setting the OOF setting for a user using PowerShell Script. The best and the easiest option I could think of was to use the Exchange Web Services Managed API 1.0 from with PowerShell 2.0. I finally got it to work! # The script requires the EWS managed API, which can be downloaded here:#…


HOWTO: Using PowerShell in ASP.NET (.NET Framework 2.0)

The easiest solution is to create a COM component and register that component with component services (COM+) running the component under a specific user identity. Why do I say this? Read on… In my case the Web site/Application was configured to run under the DefaultAppPool (Identity = Network Service) and you I wanted to use…


HOW TO: Using WebDAV from PowerShell 1.0

I was just trying my hands on PowerShell and wanted to try using WebDAV from it. I wrote a small sample that searches the inbox of a user for unread mails and lists out the Href and the Subject of the email. Create a .PS1 file as below: #Change the Server name and Credentials [System.String]$serverName…


HOW TO: Add SMTP ProxyAddresses to a mailbox using Exchange PowerShell and Managed code.

The key here is that you will first have to read all the proxy addresses using the Get-Mailbox Cmdlet and then call the Set-mailbox Cmdlet to update the ProxyAddresses. If this is not done you end up replacing all the existing addresses with the one you just added. To get the sample to work you…