我尝试通过 powershell 连接到 Exchangeonline 但出现以下错误:
Unable to find type [Microsoft.Exchange.Management.RestApiClient.ExchangeEnvironment].
At C:\ProgramFiles\WindowsPowerShell\Modules\exchangeonlinemanagement\netFramework\ExchangeOnlineManagement.psm1:274 char:9
+ [Microsoft.Exchange.Management.RestApiClient.ExchangeEnvironm ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Excha...angeEnvironment:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
我刚刚执行了以下命令来安装模块:
Install-Module -Name ExchangeOnlineManagement
Import-Module -Name ExchangeOnlineManagement
另外,我打开了 ps1。并尝试运行 ExchangeOnlineManagement.psm1 但出现错误。
Import-Module : The specified module 'Microsoft.Exchange.Management.RestApiClient.dll' was not loaded because no valid module file was found in any module directory.
有任何故障排除建议吗?
答案1
检查 Exchange Online PowerShell 模块的先决条件,并将安装和维护 Exchange Online PowerShell 模块上的详细步骤与您之前执行的步骤进行比较,检查官方博客和您的操作之间是否存在差异。
详细博客:安装和维护 Exchange Online PowerShell 模块
如果以上步骤配置正确,请按照指导连接到 Exchange Online:连接到 Exchange Online PowerShell