Links on Common PowerShell Automation Questions

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

https://msdn.microsoft.com/en-us/library/bb332449.aspx

 

Windows PowerShell

https://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

 

OUTBOX: Introduction to Exchange PowerShell Automation Part 1

https://blogs.msdn.com/mstehle/archive/2007/01/25/fyi-introduction-to-exchange-powershell-automation-part-1.aspx

 

OUTBOX: Introduction to Exchange PowerShell Automation Part 2

https://blogs.msdn.com/mstehle/archive/2007/01/25/outbox-introduction-to-exchange-powershell-automation-part-2.aspx

 

Samples:

 

Howto: Calling Exchange Powershell from an impersonated thead.

https://blogs.msdn.com/webdav_101/archive/2008/09/25/howto-calling-exchange-powershell-from-an-impersonated-thead.aspx

 

Handling results of calling Powershell - Multivalued and string arrays.

https://blogs.msdn.com/webdav_101/archive/2008/02/08/handling-results-of-calling-powershell-multivalued-and-string-arrays.aspx

 

HOWTO: csharp - Exchange PowerShell - call get-StorageGroupCopyStatus with managed code.

https://blogs.msdn.com/webdav_101/archive/2007/11/29/howto-csharp-powershell-call-get-storagegroupcopystatus-with-managed-code.aspx

 

HOWTO: csharp - PowerShell - call get-clusteredmailboxserverstatus with managed code.

https://blogs.msdn.com/webdav_101/archive/2007/11/29/howto-csharp-powershell-call-get-clusteredmailboxserverstatus-with-managed-code.aspx

 

Managing Exchange 2007 Recipients with C#

https://knicksmith.blogspot.com/2007/03/managing-exchange-2007-recipients-with.html

 

Scripting Exchange Web Services (2007) with VBS and Powershell

https://gsexdev.blogspot.com/2006/12/scripting-exchange-web-services-2007.html

 

Problems:

 

An application cannot impersonate a user and then run Windows PowerShell commands in an Exchange Server 2007 environment

https://support.microsoft.com/kb/943937/en-us

 

Call Dispose on client when calling COM+ objects.

https://blogs.msdn.com/webdav_101/archive/2008/05/29/call-dispose-on-client-when-calling-com-objects.aspx

 

KB: Automation Error 0x8007007f when Invoking Exchange 2007 Powershell Cmdlets

https://blogs.msdn.com/mstehle/archive/2007/07/03/kb-automation-error-0x8007007f-when-invoking-exchange-2007-powershell-cmdlets.aspx

 

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

https://support.microsoft.com/kb/949536

 

 

Installation:

 

How to Download Windows PowerShell 1.0

https://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx

 

How to Install Windows PowerShell and Download the Windows PowerShell SDK

https://msdn2.microsoft.com/en-us/library/Bb204630.aspx

 

How to Install the Exchange 2007 Management Tools

https://technet.microsoft.com/en-us/library/bb232090(EXCHG.80).aspx

 

How to Install Exchange 2007 SP1 Prerequisites on Windows Server 2008 or Windows Vista

https://technet.microsoft.com/en-us/library/bb691354(EXCHG.80).aspx

 

Installing Exchange 2007 Management Tools On a 32 Bit Operating System

https://support.microsoft.com/default.aspx/kb/555841

 

How to obtain the latest service pack or update rollup for Exchange 2007

https://support.microsoft.com/kb/937052

 

PowerShell Scripting Training:

 

Using the Exchange Server 2007 Management Console and Shell

https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032341118&EventCategory=3&culture=en-US&CountryCode=US

 

TechNet Webcast: Introduction to Windows PowerShell Scripting in Exchange Server 2007 (Level 200)

https://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032343633%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e

 

White Paper: Exchange Management Shell

https://technet.microsoft.com/en-us/library/bb266977(EXCHG.80).aspx

 

Other:

 

The Windows PowerShell Toolbox

https://www.microsoft.com/technet/scriptcenter/topics/winpsh/toolbox.mspx

 

Avoiding Jitter: Jumpstarting the Exchange shell (makes PowerShell run faster)

https://msexchangeteam.com/archive/2008/08/01/449426.aspx

 

Additional Tips:

  • 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.