在 Centos7 上连接到 Exchange Online PowerShell V2 的问题

问题描述

我正尝试在 Centos7 机器上使用 Powershell 脚本通过 ExchangeOnlineManagement 模块连接到 Exchange Online。安装 ExchangeOnlineManagement 模块没有问题,但是,当我尝试连接时它通常会挂起并仅显示 Creating implicit remoting module…。我终于得到了下面显示的异常,它阐明了这种情况:

PS /home/user> Connect-ExchangeOnline -AppId <app_id> -CertificateFilePath /home/user/powershell.pfx -Organization <org>.onmicrosoft.com 

----------------------------------------------------------------------------
The module allows access to all existing remote PowerShell (V1) cmdlets in addition to the 9 new,faster,and more reliable cmdlets.

|--------------------------------------------------------------------------|
|    Old Cmdlets                    |    New/Reliable/Faster Cmdlets       |
|--------------------------------------------------------------------------|
|    Get-CASMailBox                 |    Get-EXOCASMailBox                 |
|    Get-MailBox                    |    Get-EXOMailBox                    |
|    Get-MailBoxFolderPermission    |    Get-EXOMailBoxFolderPermission    |
|    Get-MailBoxFolderStatistics    |    Get-EXOMailBoxFolderStatistics    |
|    Get-MailBoxPermission          |    Get-EXOMailBoxPermission          |
|    Get-MailBoxStatistics          |    Get-EXOMailBoxStatistics          |
|    Get-MobileDeviceStatistics     |    Get-EXOMobileDeviceStatistics     |
|    Get-Recipient                  |    Get-EXORecipient                  |
|    Get-RecipientPermission        |    Get-EXORecipientPermission        |
|--------------------------------------------------------------------------|

To get additional information,run: Get-Help Connect-ExchangeOnline or check https://aka.ms/exops-docs

Send your product improvement suggestions and Feedback to exocmdletpreview@service.microsoft.com. For issues related to the module,contact Microsoft support. Don't use the Feedback alias for problems or support issues.
----------------------------------------------------------------------------

Exception: /home/user/.local/share/powershell/Modules/ExchangeOnlineManagement/2.0.4/netCore/ExchangeOnlineManagementBeta.psm1:463:44
Line |
 463 |  … oduleInfo = Import-PSSession $PSSession -AllowClobber -disableNameChe …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Running the Get-Command command in a remote session reported the following error: Processing data for a remote command Failed with the following error message:
     | MI_RESULT_Failed For more information,see the about_Remote_Troubleshooting Help topic..

所以 MI_RESULT_Failed 带我到了 this article,我基本上读到它是因为 Linux 上的 WSMan 有很多问题。我还没有尝试过他的任何建议(还),因为我想知道是否还有其他人遇到过这个问题并有解决方案。我正在使用以下版本的 Powershell 和 CentOS Linux 7.9.2009。

PS /home/user> $PsversionTable

Name                           Value
----                           -----
Psversion                      7.1.2
PSEdition                      Core
GitCommitId                    7.1.2
OS                             Linux 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017
Platform                       Unix
PSCompatibLeversions           {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)