2017-07-15 95 views
0

我得到的錯誤:刪除-MsolGroupMember使用的Exchange Online執行此操作

Remove-MsoLGroupMember : You cannot update mail-enabled groups using this cmdlet. Use Exchange Online to perform this operation

但我已經連接到遠程會話,並導入了在線交流模塊,爲何仍拋出錯誤?

$credential = Get-Credential 
$lyncSession = New-CsOnlineSession -Credential $credential 
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection 
Get-PSSession 
Import-PSSession $exchangeSession 

Remove-MsoLGroupMember -GroupObjectId $Group_GUID -GroupMemberType User -GroupmemberObjectId $GroupMembers.ObjectId 

我是按照這個鏈接來設置我的遠程連接交換,但我一定是做錯了什麼。 https://technet.microsoft.com/en-us/library/dn362787(v=ocs.15).aspx

+2

Remove-MSOLGroupMember不是Exchange Online命令,這就是您遇到錯誤的原因。您可以嘗試使用Remove-DistributiongroupMember(並非100%確定是否這是特定的EXO cmdlet,此刻我沒有機器進行驗證) – bluuf

+0

Remove-DistributiongroupMember似乎也沒有工作。我收到錯誤消息,「GroupMailbox不支持當前的操作。」正如我在對塞亞姆的回答評論中所描述的那樣。 – BLang

+1

那麼它必須是一個使用Remove-UnifiedGroupLinks作爲刪除組員成員的命令的統一組。請注意,Microsoft明確記錄了這一點,任何管理O365的人(特別是Powershell)都應該知道組類型之間的區別以及如何管理它們。 – bluuf

回答

0

如果您正在使用啓用郵件的安全組,則可以使用Remove-DistributionGroupMember,因爲Remove-MsoLGroupMember可與常規安全組一起使用。 選中此項:https://technet.microsoft.com/en-us/library/aa998016(v=exchg.160).aspx

+0

夫婦在這件事上,1)我不能通過身份參數的GUID,我得到一個錯誤(即使該鏈接說,你可以通過它)2)當我嘗試使用不同的參數來識別組(如組郵箱)我得到這個錯誤,「目前的操作不支持GroupMailbox。」 – BLang

+0

請刪除私人信息後分享您正在使用的腳本 –