Running Clear-PnPMicrosoft365GroupOwner -Identity $group should (as the docs state) clear all existing Group Owners
Actual behavior
Groups can't have zero owners, so the cmdlet deletes all but one owner and throws this error:
Clear-PnPMicrosoft365GroupOwner : One or more errors occurred.
At line:3 char:1
+ Clear-PnPMicrosoft365GroupOwner -Identity $group
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Clear-PnPMicrosoft365GroupOwner], AggregateException
+ FullyQualifiedErrorId : System.AggregateException,SharePointPnP.PowerShell.Commands.Graph.ClearMicrosoft365GroupOwner
The remaining owner is not predictable. Last added, maybe?
Steps to reproduce behavior
Connect-PnPOnline -Scopes "Directory.ReadWrite.All","Group.ReadWrite.All"
$group = Get-PnPMicrosoft365Group -Identity $groupName # Where $groupName is the display name of a Group in your tenant
Clear-PnPMicrosoft365GroupOwner -Identity $group
Which version of the PnP-PowerShell Cmdlets are you using?
[ ] PnP PowerShell for SharePoint 2013
[ ] PnP PowerShell for SharePoint 2016
[ ] PnP PowerShell for SharePoint 2019
[x] PnP PowerShell for SharePoint Online
What is the version of the Cmdlet module you are running?
3.23.2007.1
How did you install the PnP-PowerShell Cmdlets?
[ ] MSI Installed downloaded from GitHub
[x] Installed through the PowerShell Gallery with Install-Module
Expected behavior
Running
Clear-PnPMicrosoft365GroupOwner -Identity $group
should (as the docs state) clear all existing Group OwnersActual behavior
Groups can't have zero owners, so the cmdlet deletes all but one owner and throws this error:
The remaining owner is not predictable. Last added, maybe?
Steps to reproduce behavior
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
3.23.2007.1
How did you install the PnP-PowerShell Cmdlets?