Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Hi @Anonymous
Teams tag is mainly focused on the general issue of Microsoft Teams troubleshooting, script is not in our scope. The following recommendations are for informational purposes only:
How can I add "Jhon" as a admin in 50 microsoft teams.?
- Create a UserInfo.csv file which contains GroupID, UserID and Role as below. Save this file in c:\Temp\UserInfo.csv.

- Connect to Microsoft Teams module: $User = admin@xxxxxxxxxxxxx .onmicrosoft.com
$PassWord = ConvertTo-SecureString -String "YourPassword" -AsPlainText -Force $UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PassWord import-module microsoftteams
Connect-MicrosoftTeams -Credential $UserCredential -AccountId $User - Add user as owner in bulk: $users = import-csv c:\Temp\UserInfo.csv
Foreach($user in $users)
{
Add-TeamUser -GroupId $user.GroupID -User $user.UserID -Role $user.Role
}
And after that how can I remove this user to all these 50 microsoft teams.
Remove the role owner but stays as a team member: $users = import-csv c:\Temp\OwnerInfo.csv
Foreach($user in $users)
{
Remove-TeamUser -GroupId $user.GroupID -User $user.UserID -Role Owner
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.