当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] EXO V3 - 带 REST 的 PowerShell 模块

作者:精品下载站 日期:2024-12-14 13:39:07 浏览:15 分类:玩电脑

EXO V3 - 带 REST 的 PowerShell 模块


[玩转系统] EXO V3 - 带 REST 的 PowerShell 模块

EXO V3 PowerShell 模块 (ExchangeOnlineManagment) 于 2022 年 9 月 19 日发布。

EXO V3 是基于 REST 的 PowerShell API 的通用版本,用于管理 Exchange Online。

让我们仔细看看本次更新有哪些新内容。还有什么糟糕的……

在线交换 REST API

EXO V3 最重要的功能是 EXO PowerShell CmdLets 现在作为 REST API 调用运行,而不是通过远程 PowerShell 会话运行。

最明显的好处是您现在终于可以在 WinRM 上禁用基本身份验证。

以前版本的 EXO PowerShell 模块使用的远程 PowerShell 会话需要 WinRM 的基本身份验证。

您可以使用以下命令检查 WinRM 身份验证的状态:

PS C:\> & winrm get winrm/config/client/auth
Auth
    Basic = true
    Digest = true
    Kerberos = true
    Negotiate = true
    Certificate = true
    CredSSP = false

要在 WinRM 上禁用基本身份验证,请使用以下命令:

PS C:\> & winrm set winrm/config/client/auth '@{Basic="false"}'
Auth
    Basic = false
    Digest = true
    Kerberos = true
    Negotiate = true
    Certificate = true
    CredSSP = false

EXO V3 闻起来像 Beta 版

好消息是 EXO PowerShell 现在正在使用生产就绪的 REST API 调用。

或者是……?

如果我们仔细观察,我们会发现 EXO V3 通用版本使用的 REST API 仍处于测试阶段:

PS C:\> Get-Mailbox Lene.Hau -Verbose
VERBOSE: Computed version info: 3.0.0
VERBOSE: POST https://outlook.office365.com/adminapi/beta/8a35f394-855d-4d13-9f6f-86d8eb24dc6b/InvokeCommand with -1-byte payload
VERBOSE: received 4947-byte response of content type application/json;charset=utf-8

Name                      Alias           Database                       ProhibitSendQuota    ExternalDirectoryObjectId
----                      -----           --------                       -----------------    -------------------------
Lene Hau                  lene.hau        EURPR09DG188-db035             99 GB (106,300,44... 97d3bc7f-8ee6-4974-9115-c33087ad5600

EXO V3 正在调用 BETA API - 非常令人失望……

这让人怀疑有人命令 Exchange Online PowerShell 团队发布 EXO V3,尽管 Exchange Online REST API 尚未做好生产准备。

支持这种担忧的另一个事实是 Connect-ExchangeOnline CmdLet 会触发包含所有基本 Exchange Online CmdLet 的 PowerShell 模块的下载:

PS C:\> Connect-ExchangeOnline

----------------------------------------------------------------------------------------
This V3 EXO PowerShell module contains new REST API backed Exchange Online cmdlets which
doesn't require WinRM for Client-Server communication. You can now run these cmdlets after
turning off WinRM Basic Auth in your client machine thus making it more secure.

Unlike the EXO* prefixed cmdlets, the cmdlets in this module support full functional
parity with the RPS (V1) cmdlets.
V3 cmdlets in the downloaded module are resilient to transient failures, handling retries
and throttling errors inherently.

However, REST backed EOP and SCC cmdlets are not available yet. To use those, you will
need to enable WinRM Basic Auth.

For more information check https://aka.ms/exov3-module
----------------------------------------------------------------------------------------

PS C:\> Get-Command Get-Mailbox | ft -AutoSize

CommandType Name        Version Source
----------- ----        ------- ------
Function    Get-Mailbox 1.0     tmpEXO_ws2oodie.yfi


PS C:\> Get-Module tmpEXO_ws2oodie.yfi | fl


Name              : tmpEXO_ws2oodie.yfi
Path              : C:\Users\Admin\AppData\Local\Temp\tmpEXO_ws2oodie.yfi\tmpEXO_ws2oodie.yfi.psm1
Description       : This is a Powershell module generated by using the AutoGEN infra.
ModuleType        : Script
Version           : 1.0
NestedModules     : {}
ExportedFunctions : {Add-AvailabilityAddressSpace, Add-DistributionGroupMember, Add-MailboxFolderPermission, Add-MailboxLocation...}
ExportedCmdlets   :
ExportedVariables : HelpFileNames
ExportedAliases   :

如上面的输出所示,模块“tmpEXO_ws2oodie.yfi”(近 30 MB!)已下载到临时文件夹,并包含所有标准 ExchangeOnline CmdLets(Connect-ExchangeOnline 除外)。

每次连接到 Exchange Online 时,您都将下载新的临时模块。

当您从 ExchangeOnline 断开连接时,临时模块将再次被删除。但是如果您不明确断开连接,那么您的临时文件夹将包含这些 30 MB 模块

为什么不将所有内容都包含在 ExchangeOnlineManagement 模块中?每次启动 Exchange Online PowerShell 会话时下载 27.8 MB 的模块对性能来说并不是很好!

这种疯狂设计背后的原因很可能是微软仍在计划对 Exchange Online REST API 进行重大更改。 EXO V3 模块处理此问题的唯一方法是在每个会话上下载新的模块包,以防某些 CmdLets 需要更新。

我们没有留下深刻的印象……

EXO V3 令人非常失望

上述调查结果得出的结论是,EXO V3 是一种糟糕的解决方法,它会过早发布基于 API(Exchange Online REST API)构建的 API 包装器 (EXO V3),但尚未做好生产准备

EXO V3 命令与 EXO V2 CmdLets 具有相同的语法,因此如果您渴望摆脱基本的 WinRM 身份验证,则没有太多理由犹豫。

但对于应用程序开发人员来说,EXO V3 和 Exchange Online REST API 令人非常失望。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯