About: Exchange PowerShell Automation


API Type: Exchange Administration
API Interface: .NET Framework Class Libraries
Business Logic: Managing mailboxes, storage groups, and databases.
Language Support: Any .NET language.
Direct Property Access: N/A
Product Versions: Exchange 2007 and later.
Summary:
 
Exchange PowerShell was introduced with Exchange 2007 as a replacement of CDOEXM and WMI which were used for Exchange administration.   Exchange 2007 did not ship CDOEXM and WMI, which were used by Exchange 2000 and 2003 for administrative tasks.  Exchange administrators use these cmdlets manually but they can also be automated by developers using .NET. Automation for Exchange 2007 PowerShell cmdlets required that local PowerShell be used - ie PowerShell 1.0. Exchange 2010 and later require remote PowerShell calls using PowerShell 2.0+.
Exchange PowerShell cmdlets are not meant to work on the content of a mailbox outside of administrative tasks.  As an example it cannot be used to read a persons email or calendar content directly.  However, the Exchange Managed API (which uses EWS) can be used to access the content of a mailbox and public folders.  This can be done by scripting the EWS Managed API or using PowerShell Automation to do both Exchange cmdlet calls and EWS calls.  By combining both of these APIs an administrator has some incredible capabilities.
Points of Interest:
Exchange 2007:
  • The Exchange Powershell cmdlets are new to Exchange 2007 and automation of these cmdlets replaces CDOEX and WMI.
  • The Exchange Admin-Only Role must be installed on the application server in order to use Exchange cmdlets - they cannot be invoked remotely.
  • The 64-bit install of Exchange only installs the 64-bit version of Exchange cmdlets - these cmdlets cannot be used from a 32-bit process.
  • If an application server has both Exchange 2000/2003 and Exchange 2007 components on it for an application that manages both server versions it must use CDOEXM and PowerShell automation in different processes.
Exchange 2010 and later:
 Exchange 2010 and later PowerShell Automation needs to be done with Remote PowerShell 2.0+.  Local PowerShell calls are not viable and neither is PowerShell 1.0.
Important:
  • Exchange PowerShell automation requires the correct mixture of PowerShell version and call type (Local vs. Remote).  Using the incorrect type is not supported.  Exchange 2007 PowerShell Automation needs to be done with Local PowerShell 1.0. 
  • Exchange 2010 and later PowerShell Automation needs to be done with Remote PowerShell 2.0+.
  • Exchange PowerShell cmdlets need to run with Exchange Administrative permissions.
  • PowerShell itself needs to run with local machine Administrative permissions.
Basic Troubleshooting:
If a remote Exchange PowerShell call fails then be sure to try the following:
1) Always try the same command in the command shell. If it does not work in the command shell then its not going to work with .NET automation.
2) Check to see if a call to  non-Exchange cmdlet works.  This is important since Exchange cmdlets require Exchange Administrative permissions.
3) Be sure your code is running with the proper permissions and that account used has Exchange Administrative permission.
4) Be sure that the correct version of PowerShell and call type (Local versus Remote) is being used.
Exchange PowerShell - minus automation:
Exchange 2007 PowerShell (PowerShell 1.0):
Exchange 2010 and later PowerShell (PowerShell 2.0+):

Exchange Management Shell
https://msdn.microsoft.com/en-us/library/office/ff326155(v=exchg.150).aspx

Learn How to Use PowerShell to Run Exchange Commands Remotely
http://blogs.technet.com/b/heyscriptingguy/archive/2012/01/23/learn-how-to-use-powershell-to-run-exchange-server-commands-remotely.aspx

Exchange Online:
Exchange 2007 PowerShell Automation:
Links on Common PowerShell Automation Questions
Exchange 2010 and later PowerShell Automation:

HOW TO: Migrating Exchange 2007 PowerShell Managed code to work with Exchange 2010
http://blogs.msdn.com/b/akashb/archive/2010/03/25/how-to-migrating-exchange-2007-powershell-managed-code-to-work-with-exchange-2010.aspx

More Information:

HOW TO: Configure Exchange 2007 and Exchange 2010 for using Impersonation
http://blogs.msdn.com/b/akashb/archive/2010/03/10/how-to-configure-exchange-2007-and-exchange-2010-for-using-impersonation.aspx

Handling results of calling Powershell - Multivalued and string arrays.
http://blogs.msdn.com/b/webdav_101/archive/2008/02/08/handling-results-of-calling-powershell-multivalued-and-string-arrays.aspx#10274731

Akash blogging on PowerShell autagtion with .NET
http://blogs.msdn.com/b/akashb/archive/tags/powershell/

Using–Filter, Select-Object, ForEach-Object in C# – Exchange PowerShell Automation
http://blogs.msdn.com/b/akashb/archive/2012/08/02/using-filter-select-object-foreach-object-in-c-exchange-powershell-automation.aspx

Channel 9 - Articles on PowerShell
https://channel9.msdn.com/Search?term=exchange%20powershell#ch9Search

Glen's Exchange Dev Blog
http://gsexdev.blogspot.com/
This is one of my favorite sites for PowerShell scripts.

Glen Scale's Exchagne Column
http://www.outlookexchange.com/articles/glenscales/

Also see:

About: Messaging APIs
http://blogs.msdn.com/b/webdav_101/archive/2015/08/07/about-messaging-apis.aspx 

 

Comments (0)

Skip to main content