What is the fastest way to remove all users from an Azure AD group in PowerShell? I am currently using
$deleteThem = Get-MsolGroupMember -GroupObjectId $groupId -All
foreach ($user in $deleteThem) {
Remove-MsolGroupMember -GroupObjectId $groupId -GroupMemberObjectId $user.ObjectId
}
but this is painfully slow. I need to retain the group and group id though. Any ideas?