使用 Powershell 将 O365 用户邮箱转换为共享邮箱时出现问题

Issue in converting O365 user mailbox to shared mailbox with powershell

我正在编写一个脚本,在用户终止时将用户邮箱转换为共享邮箱。

我正在尝试使用以下命令

Get-Mailbox -identity $email | set-mailbox -type "Shared"

A parameter cannot be found that matches parameter name 'type'.
    + CategoryInfo          : InvalidArgument: (:) [Set-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Set-Mailbox
    + PSComputerName        : outlook.office365.com

我无法使用 set-mailbox 的 -type 参数。 谁能帮我解决这个问题,如有任何问题请告诉我?

您是管道和电子邮件身份,无需在第二个 cmdlet 中再次明确指定。

Understanding the PowerShell Pipeline

Taking the output of a get-mailbox command and piping to a set-casmailbox command

所以...这个...

Get-Mailbox -identity $email | 
Set-Mailbox -Identity $PSItem -Type Shared

邮箱很多,随便循环...

我使用的 PowerShell 版本是 4.0,后来升级到 5.1,PowerShell v5.1 的安全协议出现问题,然后当我安装 ExchangeOnlineManagement Module 时,一切正常。