How to put Teams Channel on litigation Hold using PowerShell

Aase Nomad 246 Reputation points
2022-02-15T01:44:10.433+00:00

I've been trying to put Teams channel to eDiscovery Hold(both mailbox and sharepoint) using PowerShell but I'm stuck so I would be really appreciated if I can get any help or suggestion on how to proceed with my script.

Basically the idea is, I will provide the either Private or Public Team Channel name at the begining of the script and it'll put everything on eDiscovery hold.

   $UserEmail = "username@nam.com"   
     
   Connect-MicrosoftTeams   
   Get-Team -user $UserEmail    
     
     
   $Mailbox = Get-Mailbox | Where {$_.PrimarySmtpAddress -eq $UserEmail}   
     
   Get-UnifiedGroup | Where {(Get-UnifiedGroupLinks $_.Alias -LinkType Members).DistinguishedName -contains $mailbox.DistinguishedName}   
     
     
   Get-UnifiedGroup | select DisplayName, SharePointSiteUrl   
     
   Get-MailboxFolderStatistics -Identity "Office 365 Sandbox" -FolderScope ConversationHistory -IncludeOldestAndNewestItems | ?{$_.FolderType -eq "TeamChat"} | Format-Table Name, ItemsInFolder, NewestItemReceivedDate    
   Set-Mailbox -Identity "Office 365 Sandbox" -LitigationHoldEnabled $True -GroupMailbox  
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,033 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,826 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,355 questions
{count} votes