I have the following code but unfortunately I am stuck with the -user parameter for remove-azureaduser, it comes back as resource does not exist, any powershell expert willing to help?
Edit: The idea here was that it would work with multiple teams names as well
Connect-MicrosoftTeams
$Teams = Get-Team -DisplayName "test"
$users = Get-TeamUser -GroupId $Teams.GroupId -Role Member | Select-Object user
Foreach ($user in $users) {
Remove-TeamUser -GroupId $Teams.GroupId -User $user
}