Forum Discussion

JonBow's avatar
JonBow
Copper Contributor
Sep 27, 2018
Solved

Removing unused SDS Teams

Hello everyone - long time reader, first time asker here!

 

A mistake has been made whereby we have used SDS to create Teams for every class in school, when in fact only select classes were supposed to be created. We have since updated the profile, but the original Teams remain...

 

Now, I would like to remove the unused and unwanted Teams, but I have thus far been unsuccesful in doing so.

 

1. I generate a section report (https://docs.microsoft.com/en-us/schooldatasync/whats-new-with-school-data-sync) and discarded teams which we want to keep.

 

2. I created a PowerShell script which I thought would https://docs.microsoft.com/en-us/powershell/module/teams/remove-team?view=teams-ps thusly:

 

connect-MicrosoftTeams
remove-team -groupid "<groupID>"

 

However, it returns an error

 

remove-team : Error occurred while executing 
Code: Request_ResourceNotFound
Message: Resource '<groupID>' does not exist or one of its queried reference-property objects are not present.

 

I assume this is because the Team doesn't yet exist, at least, not until the teacher opens it for the first time.

 

So, can anybody please guide me - how do I remove these unused and unwanted Teams??

 

Thank you in advance

 

JB

  • Appreciate your reply, thank you. I wondered if this was the solution - shame the Teams cmdlet didn't work, but I suppose it is still in Beta.

     

    For reference, once you have the IDs of the Teams/Groups you want to remove, the following is the correct Powershell

     

    Connect-MsolService
    remove-msolgroup -objectid "<groupID>" -force

     Note: the

    -force

     means it doesn't ask for confirmation.

     

    So use this with caution people :)

2 Replies

  • Not sure why remove-team fails, but you could just delete the team by deleting the Office Group using Azure AD or Exchange Online cmdlets.
    • JonBow's avatar
      JonBow
      Copper Contributor

      Appreciate your reply, thank you. I wondered if this was the solution - shame the Teams cmdlet didn't work, but I suppose it is still in Beta.

       

      For reference, once you have the IDs of the Teams/Groups you want to remove, the following is the correct Powershell

       

      Connect-MsolService
      remove-msolgroup -objectid "<groupID>" -force

       Note: the

      -force

       means it doesn't ask for confirmation.

       

      So use this with caution people :)

Resources