簡體   English   中英

有沒有辦法使用 PowerShell 從 SharePoint 在線組中刪除安全組?

[英]Is there a way to remove security groups from SharePoint Online groups using PowerShell?

我想從幾個 SharePoint 站點成員組中刪除一些安全組(我專門談論 SharePoint 組,而不是 O365 組)。 例如,我想從多個站點的“...成員”組中刪除“除外部用戶外的所有人”。

我知道您可以使用 Add-SPOUser 將安全組添加到 SharePoint 組,但使用 Remove-SPOUser 似乎無法刪除它們。 我收到以下錯誤: Remove-SPOUser:用戶不存在或不唯一。

我嘗試同時使用安全組 ID 和顯示名稱,但均無效:Remove-SPOUser -Site https://mytenant.sharepoint.com/sites/SiteExample -LoginName "SecGroupDisplayName" -Group "Site Example Members"

有沒有辦法以編程方式執行此操作?

事實證明,PnP PowerShell 模塊可以使用安全組顯示名稱實現此目的:

刪除-PnPUser-Identity“SecGroupDisplayName”-Force

命令的文檔在這里: https://pnp.github.io/powershell/cmdlets/Remove-PnPUser.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM