I’ve put together a list of articles which cover common questions on Exchange PowerShell Automation. These links cover issues from starting out to common problems. I hope they help. Please let me know if there are others you see as important.
Starting articles on automation:
Using Exchange Management Shell Commands with Managed Code
OUTBOX: Introduction to Exchange PowerShell Automation Part 1
OUTBOX: Introduction to Exchange PowerShell Automation Part 2
Howto: Calling Exchange Powershell from an impersonated thead.
Handling results of calling Powershell – Multivalued and string arrays.
HOWTO: csharp – Exchange PowerShell – call get-StorageGroupCopyStatus with managed code.
HOWTO: csharp – PowerShell – call get-clusteredmailboxserverstatus with managed code.
An application cannot impersonate a user and then run Windows PowerShell commands in an Exchange Server 2007 environment
Call Dispose on client when calling COM+ objects.
KB: Automation Error 0x8007007f when Invoking Exchange 2007 Powershell Cmdlets
PowerShell commands for the Exchange 2007 Edge server role do not work as expected after you uninstall an update rollup or an interim update on the Edge server
How to Download Windows PowerShell 1.0
How to Install Windows PowerShell and Download the Windows PowerShell SDK
How to Install the Exchange 2007 Management Tools
How to Install Exchange 2007 SP1 Prerequisites on Windows Server 2008 or Windows Vista
Installing Exchange 2007 Management Tools On a 32 Bit Operating System
How to obtain the latest service pack or update rollup for Exchange 2007
PowerShell Scripting Training:
TechNet Webcast: Introduction to Windows PowerShell Scripting in Exchange Server 2007 (Level 200)
White Paper: Exchange Management Shell
The Windows PowerShell Toolbox
Avoiding Jitter: Jumpstarting the Exchange shell (makes PowerShell run faster)
When you run into a problem with automation code, see if it reproduces in the command shell. If it reproduces in then command shell then the issue is not with your .NET code. So, be sure to always test the same call from the command shell, otherwise you will be troubleshooting the wrong area.
If the call the PowerShell cmdlet or script works in the command shell but not your .NET application then try calling a non-Exchange PowerShell cmdlet to see if it works. This is an extremely important test as it will tell if the issue is Exchange PowerShell cmdlet specific or it if its more of a general PowerShell automation issue. Exchange specific PowerShell automation issues are often tied to permissions.
Always keep in mind that to do a PowerShell call that the .NET application needs to run under local admin privileges and that account used to make the PowerShell call to the Exchange server needs to have Exchange Admin privileges. Having anything less than those two won’t work.
If you run into an issue with script or automation code and think it should work, verify that you have the current service packs installed.
To avoid possible issues with the console, be sure that the version of the tools running PowerShell code are at the same SP/fix level as the other servers.
Don’t try to do Local PowerShell calls or PowerShell 1 calls against Exchange 2010 and later – such calls are not supported and likely not to work.