Some cmdlets fail in PowerShell ISE after an upgrade to Exchange Server 2010 SP3

Article translations Article translations
Article ID: 2859999 - View products that this article applies to.
Expand all | Collapse all

Symptoms

Consider the following scenario: 
  • You upgrade a Microsoft Exchange Server Service Pack 2 (SP2) Rollup 6 environment to Microsoft Exchange Server 2010 Service Pack 3 (SP3).
  • The Exchange Server 2010 SP3 management tools are installed on a client computer.
  • You use PowerShell Integrated Scripting Environment (ISE) to open a local Windows PowerShell instance on the client computer.
  • You add the Exchange snap-ins. For example, you add the following Exchange snap-in:
    • Add-PSSnapin Microsoft.exchange.powershell.e2010
In this scenario, some Exchange cmdlets no longer work. For example, the following cmdlets no longer work:
  • Test-WebServicesConnectivity –ClientAccessServer "Servername" –TrustanySSLcertificate
  • Set-CASMailbox
Note Other cmdlets might also not work in this scenario.

Additionally, you receive the following error message in PowerShell ISE:
Add-PSSSnapin Microsoft.Exchange.Management.PowerShell.E2010
PS H:\> Test-WebServicesConnectivity -ClientAccessServer <Clinet Access Server Name>
ARNING: An unexpected error has occurred and a Watson dump is being generated: Operation is not valid due to the current state of the object.
Test-WebServicesConnectivity : Operation is not valid due to the current state of the object.

Also, the following error is logged in the Application log:

Time: -
ID
: 8
Level: Error
Source: MSExchange CmdletLogs
Machine: -
Message: (PID 12460, Thread 9) Task Test-WebServicesConnectivity throwing unhandled exception: System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Microsoft.Exchange.Data.Storage.ExchangePrincipal.get_ServerFullyQualifiedDomainName()
at Microsoft.Exchange.Monitoring.TestCasConnectivity.ResetAutomatedCredentialsAndVerify(TestCasConnectivityRunInstance instance)
at Microsoft.Exchange.Monitoring.TestCasConnectivity.BuildRunInstanceForSiteMBox(String deviceId)
at Microsoft.Exchange.Monitoring.TestCasConnectivity.BuildRunInstances()
at Microsoft.Exchange.Monitoring.TestCasConnectivity.InternalProcessRecord()
at Microsoft.Exchange.Configuration.Tasks.Task.ProcessRecord().

Workaround

To work around this issue, open a remote session to an Exchange server by using the following cmdlets at the beginning of the ISE script:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange 2010 server>/PowerShell/ -Authentication Kerberos
import-pssession $session
add-pssnapin microsoft.exchange*
test-webservicesconnectivity -clientaccessserver CASSERVER –trustanysslcertificate

More information

The Exchange cmdlets can be run in the following scenarios:
  • In Exchange Management Shell on an Exchange server.
  • In Exchange Management Shell on a computer that has Management Tools installed.
  • In PowerShell on an Exchange server after the Exchange snap-ins are loaded. 
  • In PowerShell ISE on an Exchange server after the Exchange snap-ins are loaded.
Note Running cmdlets in a local PowerShell instance is not supported in Exchange Server 2010, unless this use is explicitly documented as being required in Exchange Server 2010 TechNet documentation. For more information, see the following Microsoft MSDN article:
Local Runspaces are not supported in Exchange 2010
The Exchange cmdlets cannot be run in the following scenarios:
  • From PowerShell on a computer that is not running Exchange Server but that has the Exchange Server SP3 management tools installed.
  • From PowerShell ISE on a computer that is not running Exchange Server but that has the Exchange Server SP3 management tools installed.

Properties

Article ID: 2859999 - Last Review: June 21, 2013 - Revision: 1.0
Applies to
  • Microsoft Exchange Server 2010 Service Pack 3
Keywords: 
kbsurveynew kbtshoot kbexpertiseinter KB2859999

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com