# Find Archived MS Team Groups

Find archived Teams groups and review the example that compares them with groups created in the current year. The source notes that Get-Team does not return the creation timestamp.

!!!warning Source-derived reference
These notes were recovered from OneNote. Configuration, permissions and operating results have not been freshly verified. Confirm the applicable authority and environment before acting.
!!!

## Scenario 1: Find All Archived Team Groups

1.  **Connect to Teams** using: [Connect To Teams](connect-to-teams-ms-graph.md)
2.  **Get all Teams/Groups that have been Archived** \$AllArchivedGroups = Get-Team -Archived \$true

Read-More About **Get-Team**: [Get-Team (MicrosoftTeams) \| Microsoft Learn](https://learn.microsoft.com/en-us/powershell/module/microsoftteams/get-team?view=teams-ps)

## Scenario 2: Find ArchivedGroups that were created in the current year.

**Limitation:** Get-Team doesn't return the Created DateTime for the group.

### Compare with groups created this year

1.  **Extract GroupId's from all Archived Groups**

``` powershell
$ListOfArchivedGroupId = $AllArchivedGroups.GroupId
```

1.  **Get All Groups created in the current year**

``` powershell
Connect-MgGraph
$currentYear = (Get-Date).Year
$GroupsFromCurrentYear = Get-MgGroup -All | Where-Object { $_.CreatedDateTime.Year -eq $currentYear}
```

1.  **Get GroupId's of all Groups Created in the current year**

``` powershell
Connect-MgGraph
$currentYear = (Get-Date).Year
$GroupIdsFromCurrentYear = Get-MgGroup -Select Id,CreatedDateTime -All | Where-Object { $_.CreatedDateTime.Year -eq $currentYear } | Select-Object -ExpandProperty Id
```

## Related guidance

- [Topic overview](Introduction.md)
- [Source review status](../../review/Review-status.md)
