徵兆
安裝 Microsoft Exchange Server 2019、2016 或 2013 的 2021 年 4 月安全性更新 (或較新的更新) 之後,應用程式開始傳回下列其中一個錯誤訊息:
訊息 1
此執行空間不支援語法。 如果執行空間是非語言模式,則可能會發生此情況。
訊息 2
發生 System.Management.Automation.RemoteException 例外狀況:此執行空間不支援該語法。 如果執行空間是非語言模式,則可能會發生此情況。 於 System.Management.Automation.Runspaces.AsyncResult.EndInvoke() at System.Management.Automation.PowerShell.CoreInvokeRemoteHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output,
在此情況下,應用程式不會從執行 Exchange Server 的伺服器透過遠端 PowerShell 來擷取資訊。 在某些情況下,應用程式會停止回應。
原因
Exchange 型伺服器上 Exchange 管理主控台端點從 FullLanguage 模式變更為 NoLanguage 模式。 使用遠端 PowerShell 的 FullLanguage 模式功能的應用程式現在在處理遠端 PowerShell 呼叫時會遇到「徵狀」小節中所述的錯誤。
解決方案
若要解決此問題,應用程式開發人員必須更新應用程式,才能使用 Exchange Shell 的新的、更具限制狀態。
此外,建議您使用下列其中一個解決方案:
-
確定使用 .invoke() 的所有呼叫也使用 .AddCommand() 而不是 .AddScript()。 如需詳細資訊,請參閱 about_Language_Modes - PowerShell | Microsoft Docs 提供的指導。
-
實作匯入的工作階段而非使用 .invoke()。 如需詳細資訊,請參閱 GitHub 上的 David-Barrett-MS/ExchangePowerShellAutomationSample。 此網頁提供範例應用程式,其示範如何連接到 Exchange 遠端 PowerShell,並以程式設計方式執行 Cmdlet。
詳細資訊
如需 2021 年 4 月安全性更新的詳細資訊,請參閱下列 Exchange 小組部落格文章: