AvaFX Posted August 18, 2020 Posted August 18, 2020 Hi guys, Has anyone managed to successfully archive Teams in bulk? Our SMT have decided that they'd like to archive all Teams (around 600) however on Microsoft's documentation I can only find a GUI option (one by one). If so, I'd be very grateful for some tips Thank you! A
samct6 Posted August 18, 2020 Posted August 18, 2020 From a very quick glance, you can now use Connect-MicrosoftTeam, sign in with O365 account and use a command called Set-TeamArchivedState. I should imagine you could export the list of Teams into CSV, import CSV into script, use a loop to archive each row of CSV. Here's the link to some of the commands: https://docs.microsoft.com/en-us/powershell/module/teams/set-teamarchivedstate?view=teams-ps 1
Katy Posted August 18, 2020 Posted August 18, 2020 I've got to look at this next week, but I'm expecting to be able to do (Get-Teams).Where{**filter team names here**} | Set-TeamsArchivedState
AJWhite1970 Posted August 18, 2020 Posted August 18, 2020 Not tried it yet but this was discussed last month with a potential solution http://www.edugeek.net/forums/cloud-services/216221-teams-eoy-markdown-archive-re-make-end-term.html#post1852463 1
AvaFX Posted August 25, 2020 Author Posted August 25, 2020 Not tried it yet but this was discussed last month with a potential solution http://www.edugeek.net/forums/cloud-services/216221-teams-eoy-markdown-archive-re-make-end-term.html#post1852463 I gave it a whirl and it worked, thanks so much for this link! A 1
ozydave Posted August 25, 2020 Posted August 25, 2020 Have been trying Set-TeamArchivedState command all day. Should be simple enough but keep getting power shell errors. “Bad Gateway” Tried running from home on different hardware but no joy
broadld Posted August 27, 2020 Posted August 27, 2020 Did you use SDS to create the Teams? We had the bad gateway error when trying to archive. Apparently this happens when the Team and the SharePoint site are out of sync. I have a script to archive these. I will try to dig it out
3s-gtech Posted August 27, 2020 Posted August 27, 2020 Successfully used the archive feature of SDS yesterday to do this, then used Salamander to create all the new ones today. Will be leaving the manually created Teams for now.
broadld Posted August 28, 2020 Posted August 28, 2020 For anyone with the bad gateway issue this may archive those Teams that wouldn't previously archive. Thise searches for any team with mailnickname like Section_* Please amend as necessary for your environment and i would recommend to test on one test Team first! $creds = Get-Credential Connect-MicrosoftTeams -Credential $creds $teams = Get-Team | Where-Object {$_.MailNickName -like "Section_*" -and $_.Archived -eq $false} foreach ($team in $teams) { try { $state = "Read-only" Set-TeamArchivedState -GroupId $team.GroupId -Archived $true -SetSpoSiteReadOnlyForMembers $true } catch { $state = "BROKEN" Set-TeamArchivedState -GroupId $team.GroupId -Archived $true -SetSpoSiteReadOnlyForMembers $False } finally { Write $($team.MailNickName + " - " + $team.GroupId + " - " + $state ) } } 2
ozydave Posted August 28, 2020 Posted August 28, 2020 For anyone with the bad gateway issue this may archive those Teams that wouldn't previously archive. Thise searches for any team with mailnickname like Section_* Please amend as necessary for your environment and i would recommend to test on one test Team first! $creds = Get-Credential Connect-MicrosoftTeams -Credential $creds $teams = Get-Team | Where-Object {$_.MailNickName -like "Section_*" -and $_.Archived -eq $false} foreach ($team in $teams) { try { $state = "Read-only" Set-TeamArchivedState -GroupId $team.GroupId -Archived $true -SetSpoSiteReadOnlyForMembers $true } catch { $state = "BROKEN" Set-TeamArchivedState -GroupId $team.GroupId -Archived $true -SetSpoSiteReadOnlyForMembers $False } finally { Write $($team.MailNickName + " - " + $team.GroupId + " - " + $state ) } }Thanks, I will give this a bash
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now