我正在尝试通过 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.
对故障排除有何建议?
检查 Exchange Online PowerShell 模块的先决条件,并将安装和维护 Exchange Online PowerShell 模块的详细步骤与您之前执行的操作进行比较,以检查官方博客与您的操作之间是否有任何差异。
详细博客:安装和维护 Exchange Online PowerShell 模块
如果上述步骤配置正确,请按照指导连接到在线交换:连接到 Exchange Online PowerShell