Jump to content

Recommended Posts

Posted

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

Posted
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
Posted

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

Posted
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
Posted
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.
Posted

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 2
Posted
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...