Alcuni cmdlet hanno esito negativo in PowerShell ISE dopo un aggiornamento a Exchange Server 2010 SP3

Numero KB originale: 2859999

Sintomi

Considerare lo scenario descritto di seguito:

  • Si aggiorna un ambiente Exchange Server Service Pack 2 (SP2) Rollup 6 a Exchange Server 2010 SP3.
  • Gli strumenti di gestione Exchange Server 2010 SP3 vengono installati in un computer client.
  • Usare l'ambiente di scripting integrato di PowerShell per aprire un'istanza di Windows PowerShell locale nel computer client.
  • Aggiungere gli snap-in di Exchange. Ad esempio, si aggiunge lo snap-in di Exchange seguente:
    Add-PSSnapin Microsoft.exchange.powershell.e2010

In questo scenario alcuni cmdlet di Exchange non funzionano più. Ad esempio, i cmdlet seguenti non funzionano più:

  • Test-WebServicesConnectivity -ClientAccessServer "Servername" -TrustanySSLcertificate
  • Set-CASMailbox

Nota

Anche altri cmdlet potrebbero non funzionare in questo scenario.

Viene inoltre visualizzato il messaggio di errore seguente 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.

Inoltre, nel registro applicazioni viene registrato l'errore seguente:

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().

Soluzione alternativa

Per risolvere questo problema, aprire una sessione remota a un server Exchange usando i cmdlet seguenti all'inizio dello script ISE:

$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

Scenari in cui è possibile eseguire i cmdlet di Exchange

  • In Exchange Management Shell in un server Exchange.
  • In Exchange Management Shell in un computer in cui sono installati strumenti di gestione.
  • In PowerShell in un server Exchange dopo il caricamento degli snap-in di Exchange.
  • In PowerShell ISE in un server Exchange dopo il caricamento degli snap-in di Exchange.

Nota

L'esecuzione di cmdlet in un'istanza di PowerShell locale non è supportata in Exchange Server 2010, a meno che questo uso non sia documentato in modo esplicito come richiesto nella documentazione technet di Exchange Server 2010. Per altre informazioni, vedere Spazi di esecuzione locali non supportati in Exchange 2010.

Scenari in cui non è possibile eseguire i cmdlet di Exchange

  • Da PowerShell in un computer che non esegue Exchange Server ma in cui sono installati gli strumenti di gestione Exchange Server SP3.
  • Da PowerShell ISE in un computer che non esegue Exchange Server ma in cui sono installati gli strumenti di gestione Exchange Server SP3.