Home

PowerShell script to export Microsoft Teams Usage in CSV format used to Audit an Office 365 Tenant

%3CLINGO-SUB%20id%3D%22lingo-sub-484713%22%20slang%3D%22en-US%22%3EPowerShell%20script%20to%20export%20Microsoft%20Teams%20Usage%20in%20CSV%20format%20used%20to%20Audit%20an%20Office%20365%20Tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-484713%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3EAfter%20the%20previous%20scripts%20published%20to%20audit%20an%20Office%20365%20Tenant%3A%3C%2FP%3E%0A%3CUL%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20clear%3A%20left%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20list-style-image%3A%20none%3B%20list-style-position%3A%20outside%3B%20list-style-type%3A%20disc%3B%20margin-bottom%3A%2012px%3B%20margin-top%3A%200px%3B%20orphans%3A%202%3B%20padding-left%3A%2040px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%230077d4%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSharePoint%2FPowerShell-script-to-export-SharePoint-Usage-in-CSV-format-used%2Fm-p%2F357535%23M27324%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSharePoint%2FPowerShell-script-to-export-SharePoint-Usage-in-CS...%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%230077d4%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-Stream-Forum%2FPowerShell-script-to-audit-and-export-Channel-content-details-of%2Fm-p%2F354832%23M3011%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-Stream-Forum%2FPowerShell-script-to-audit-and-export-...%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%230077d4%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FOffice-365-Video%2FPowerShell-script-to-audit-and-export-all-content-details-of%2Fm-p%2F352594%23M830%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FOffice-365-Video%2FPowerShell-script-to-audit-and-export-all-co...%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%230077d4%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FExchange%2FPowerShell-script-to-export-Exchange-Usage-in-CSV-format-used-to%2Fm-p%2F356287%23M3063%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FExchange%2FPowerShell-script-to-export-Exchange-Usage-in-CSV-fo...%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FOneDrive-for-Business%2FPowerShell-script-to-export-OneDrive-Usage-in-CSV-format-used-to%2Fm-p%2F482670%23M5370%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FOneDrive-for-Business%2FPowerShell-script-to-export-OneDrive-Usage-in-CSV-format-used-to%2Fm-p%2F482670%23M5370%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20script%20is%20now%20dedicated%20to%20Microsoft%20Teams%20case.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EImport-Module%20MSOnline%0AImport-Module%20MicrosoftTeams%0A%0A%5Bstring%5D%24ReportPath%20%3D%20%22.%5CReports%5C%22%0A%5Bstring%5D%24username%20%3D%20%22Admin%40yourtenant.onmicrosoft.com%22%0A%5Bstring%5D%24PwdTXTPath%20%3D%20%22C%3A%5CSECUREDPWD%5CExportedPWD-%24(%24username).txt%22%0A%24secureStringPwd%20%3D%20ConvertTo-SecureString%20-string%20(Get-Content%20%24PwdTXTPath)%0A%24cred%20%3D%20New-Object%20System.Management.Automation.PSCredential%20-ArgumentList%20%24username%2C%20%24secureStringPwd%0A%0A%24session%20%3D%20New-PSSession%20-ConfigurationName%20Microsoft.Exchange%20-ConnectionUri%20https%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%2F%20-Credential%20%24cred%20-Authentication%20Basic%20-AllowRedirection%0AImport-PSSession%20%24session%0A%0A%23Connect-MicrosoftTeams%20-Credential%20%24cred%0AConnect-MicrosoftTeams%20%0A%0A%5Bint%5D%24i%20%3D%201%3B%0A%24data%20%3D%20%40()%0A%5Bstring%5D%24ListOfChannelNames%20%3D%20%22%22%0A%5Bstring%5D%24TeamOwnersEmails%20%3D%20%22%22%0A%5Bstring%5D%24TeamMembersEmails%20%3D%20%22%22%0A%5Bstring%5D%24TeamGuestsEmails%20%3D%20%22%22%0A%0A%24ListOfTeams%20%3D%20Get-Team%20%20-user%20%24username%20%23Test%20command%20to%20focus%0A%23%24ListOfTeams%20%3D%20Get-Team%0A%0AWrite-host%20%22%20--------------------------------------------------------------------------------------------%20%22%20-ForegroundColor%20Magenta%0A%0A%0Aforeach(%24MyTeams%20in%20%24ListOfTeams)%0A%7B%0A%20Write-host%20%22%20--------------------------------------------------------------------------------------------%20%22%20-ForegroundColor%20green%0A%0A%20%24TeamUnifiedGroup%20%3D%20Get-UnifiedGroup%20-Identity%20%24MyTeams.GroupId%0A%20Write-Host%20%22%20%20%20%20%3D%3D%3D-%26gt%3B%20Teams%20GroupID%3A%22%2C%20%24MyTeams.GroupId%2C%20%22-%20Name%3A%22%2C%20%24MyTeams.DisplayName%2C%20%22-%20Description%3A%22%2C%20%24MyTeams.Description%20%20-ForegroundColor%20Yellow%0A%20Write-Host%20%22%20%20%20%20%3D%3D%3D-%26gt%3B%20GroupEmail%3A%22%2C%20%24TeamUnifiedGroup.PrimarySmtpAddress%0A%0A%20%23%20Current%20Teams%20Configuration%20implemented%0A%20Write-Host%20%22%20%20%20%20%3D%3D%3D-%26gt%3B%20Get-TeamMemberSettings%3A%22%20-ForegroundColor%20Yellow%0A%20%20%20%20%24TeamMemberSettings%20%3D%20Get-TeamMemberSettings%20-GroupId%20%24MyTeams.GroupId%0A%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%3D%26gt%3B%20%22%2C%20%24TeamMemberSettings.AllowCreateUpdateChannels%0A%0A%20%20%20%20Write-Host%20%22%20%20%20%20%3D%3D%3D-%26gt%3B%20Get-TeamMessagingSettings%3A%22%20-ForegroundColor%20Yellow%0A%20%20%20%20%24TeamMessagingSettings%20%3D%20Get-TeamMessagingSettings%20-GroupId%20%24MyTeams.GroupId%0A%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%3D%26gt%3B%20%22%2C%20%24TeamMessagingSettings.AllowUserEditMessages%0A%0A%20%20%20%20Write-Host%20%22%20%20%20%20%3D%3D%3D-%26gt%3B%20Get-TeamGuestSettings%3A%22%20-ForegroundColor%20Yellow%0A%20%20%20%20%24TeamGuestSettings%20%3D%20Get-TeamGuestSettings%20-GroupId%20%24MyTeams.GroupId%0A%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%3D%26gt%3B%20%22%2C%20%24TeamGuestSettings.AllowCreateUpdateChannels%0A%0A%20%20%20%20Write-Host%20%22%20%20%20%20%3D%3D%3D-%26gt%3B%20Get-TeamFunSettings%3A%22%20-ForegroundColor%20Yellow%0A%20%20%20%20%24TeamFunSettings%20%3D%20Get-TeamFunSettings%20-GroupId%20%24MyTeams.GroupId%0A%20Write-Host%20%22%20%20%20%20%20%20%20%20%20%20%3D%3D%3D%3D%26gt%3B%20%22%2C%20%24TeamFunSettings.AllowGiphy%0A%0A%20%24ListOfChannelNames%20%3D%20%22%22%0A%20%24TeamOwnersEmails%20%3D%20%22%22%0A%20%24TeamMembersEmails%20%3D%20%22%22%0A%20%24TeamGuestsEmails%20%3D%20%22%22%0A%20%20%20%20%24CurrentListOfChannelList%20%3D%20Get-TeamChannel%20-GroupId%20%24MyTeams.GroupId%0A%20%20%20%20foreach(%24MyChannel%20in%20%24CurrentListOfChannelList)%0A%20%20%20%20%7B%0A%20%20%20%20%20Write-host%20%22%20%20%20%20%20%20------------------%20%22%20-ForegroundColor%20green%0A%20%20%20%20%20Write-Host%20%22%20%20%20%20%20%20%3D%3D%3D-%26gt%3B%20Channel%20Name%3A%22%2C%20%24MyChannel.Id%2C%20%22-%20Name%3A%22%2C%20%24MyChannel.DisplayName%2C%20%22-%20Description%3A%22%2C%20%24MyChannel.Description%20%20-ForegroundColor%20Magenta%0A%20%20%20%20%20%20%20%20%24ListOfChannelNames%20%2B%3D%20%22%20-%7C-%20%22%2B%20%24MyChannel.DisplayName%0A%20%20%20%20%7D%0A%0A%20%20%20%20%24TeamUsers%20%3D%20Get-TeamUser%20-GroupId%20%24MyTeams.GroupId%0A%20%20%20%20Write-Host%20%22%20%20%20%20%3D%3D%3D-%26gt%3B%20Get-TeamUser%3A%22%2C%20%24TeamUsers.Count%20-ForegroundColor%20Yellow%0A%20if%20(%5Barray%5D%24MyTeamGuest%20%3D%20%24TeamUsers%20%7C%20Where%20%7B%24_.Role%20-eq%20%22guest%22%7D)%0A%20%7B%0A%20%20%24TeamGuestsCount%20%3D%20%24MyTeamGuest.Count%0A%20%20%24MyTeamGuest.ForEach(%7B%20%24TeamGuestsEmails%20%2B%3D%20%22%7C%22%2B%20%24_.User%20%20%7D)%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%3D%3D%3D-%26gt%3B%20TeamGuestsEmails%3A%22%2C%20%24TeamGuestsEmails%20-ForegroundColor%20Magenta%0A%20%20%20%20%7D%0A%20else%0A%20%7B%0A%20%20%24TeamGuestsCount%20%3D%200%0A%20%20%24TeamGuestsEmails%20%3D%20%22%22%0A%20%20%20%20%7D%0A%0A%20if%20(%5Barray%5D%24MyTeamMembers%20%3D%20%24TeamUsers%20%7C%20Where%20%7B%24_.Role%20-eq%20%22member%22%7D)%0A%20%7B%0A%20%20%24TeamMembersCount%20%3D%20%24MyTeamMembers.Count%0A%20%20%24MyTeamMembers.ForEach(%7B%20%24TeamMembersEmails%20%2B%3D%20%22%7C%22%2B%20%24_.User%20%20%7D)%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%3D%3D%3D-%26gt%3B%20TeamMembersEmails%3A%22%2C%20%24TeamMembersEmails%20-ForegroundColor%20Magenta%0A%20%20%20%20%7D%0A%20else%0A%20%7B%0A%20%20%24TeamMembersCount%20%3D%200%0A%20%20%24TeamMembersEmails%20%3D%20%22%22%0A%20%20%20%20%7D%0A%0A%20if%20(%5Barray%5D%24MyTeamOwners%20%3D%20%24TeamUsers%20%7C%20Where%20%7B%24_.Role%20-eq%20%22owner%22%7D)%0A%20%7B%0A%20%20%24TeamOwnersCount%20%3D%20%24MyTeamOwners.Count%0A%20%20%24MyTeamOwners.Foreach(%7B%20%24TeamOwnersEmails%20%2B%3D%20%22%7C%22%2B%20%24_.User%20%20%7D)%0A%20%20Write-Host%20%22%20%20%20%20%20%20%20%3D%3D%3D-%26gt%3B%20TeamOwnersEmails%3A%22%2C%20%24TeamOwnersEmails%20-ForegroundColor%20Magenta%0A%20%20%20%20%7D%0A%20else%0A%20%7B%0A%20%20%24TeamOwnersCount%20%3D%200%0A%20%20%24TeamOwnersEmails%20%3D%20%22%22%0A%20%20%20%20%7D%0A%0A%23Team%20name%20TeamMail%20Channels%20MembersCount%20OwnersCount%20GuestsCount%20Privacy%0A%0A%20%24data%20%2B%3D%20%40(%0A%20%20%5Bpscustomobject%5D%40%7B%0A%20%20GroupID%20%3D%20%24MyTeams.GroupId%0A%20%20GroupTeamMail%20%3D%20%24TeamUnifiedGroup.PrimarySmtpAddress%0A%20%20GroupHiddenfromOutlook%20%3D%20%24TeamUnifiedGroup.HiddenFromExchangeClientsEnabled%0A%20%20GroupAccessType%20%3D%20%24TeamUnifiedGroup.AccessType%0A%20%20GroupExternalMemberCount%20%3D%20%24TeamUnifiedGroup.GroupExternalMemberCount%0A%20%20TeamName%20%3D%20%24MyTeams.DisplayName%0A%20%20TeamDescription%20%3D%20%24MyTeams.Description%0A%20%20TeamMemberSettingsAllowCreateUpdateChannels%20%3D%20%24TeamMemberSettings.AllowCreateUpdateChannels%0A%20%20TeamMemberSettingsAllowDeleteChannels%20%3D%20%24TeamMemberSettings.AllowDeleteChannels%0A%20%20TeamMemberSettingsAllowAddRemoveApps%20%3D%20%24TeamMemberSettings.AllowAddRemoveApps%0A%20%20TeamMemberSettingsAllowCreateUpdateRemoveTabs%20%3D%20%24TeamMemberSettings.AllowCreateUpdateRemoveTabs%0A%20%20TeamMemberSettingsAllowCreateUpdateRemoveConnectors%20%3D%20%24TeamMemberSettings.AllowCreateUpdateRemoveConnectors%0A%20%20TeamMessagingSettingsAllowUserEditMessages%20%3D%20%24TeamMessagingSettings.AllowUserEditMessages%0A%20%20TeamMessagingSettingsAllowUserDeleteMessages%20%3D%20%24TeamMessagingSettings.AllowUserDeleteMessages%0A%20%20TeamMessagingSettingsAllowOwnerDeleteMessages%20%3D%20%24TeamMessagingSettings.AllowOwnerDeleteMessages%0A%20%20TeamMessagingSettingsAllowTeamMentions%20%3D%20%24TeamMessagingSettings.AllowTeamMentions%0A%20%20TeamMessagingSettingsAllowChannelMentions%20%3D%20%24TeamMessagingSettings.AllowChannelMentions%0A%20%20TeamGuestSettingsAllowCreateUpdateChannels%20%3D%20%24TeamGuestSettings.AllowCreateUpdateChannels%0A%20%20TeamGuestSettingsAllowDeleteChannels%20%3D%20%24TeamGuestSettings.AllowDeleteChannels%0A%20%20TeamFunSettingsAllowGiphy%20%3D%20%24TeamFunSettings.AllowGiphy%0A%20%20TeamFunSettingsGiphyContentRating%20%3D%20%24TeamFunSettings.GiphyContentRating%0A%20%20TeamFunSettingsAllowStickersAndMemes%20%3D%20%24TeamFunSettings.AllowStickersAndMemes%0A%20%20TeamFunSettingsAllowCustomMemes%20%3D%20%24TeamFunSettings.AllowCustomMemes%0A%20%20TeamChannelsCount%20%3D%20%24CurrentListOfChannelList.Count%0A%20%20TeamChannelsNames%20%3D%20%24ListOfChannelNames%0A%20%20TeamOwnersCount%20%3D%20%24TeamOwnersCount%0A%20%20TeamOwnersEmails%20%3D%20%24TeamOwnersEmails%0A%20%20TeamMembersCount%20%3D%20%24TeamMembersCount%0A%20%20TeamMembersEmails%20%3D%20%24TeamMembersEmails%0A%20%20TeamGuestsCount%20%3D%20%24TeamGuestsCount%0A%20%20TeamGuestsEmails%20%3D%20%24TeamGuestsEmails%0A%20%20%7D%0A%20)%0A%0A%0A%20Write-host%20%22%20--------------------------------------------------------------------------------------------%20%22%20-ForegroundColor%20green%0A%7D%0A%0AWrite-host%20%22%20--------------------------------------------------------------------------------------------%20%22%20-ForegroundColor%20green%0A%0A%24datestring%20%3D%20(get-date).ToString(%22yyyyMMdd-hhmm%22)%0A%24fileName%20%3D%20Join-Path%20-Path%20%24ReportPath%20%20-ChildPath%20%24(%22O365-TeamsDetails_%22%2B%20%24datestring%20%2B%20%22.csv%22)%0A%20%0AWrite-host%20%22%20-----------------------------------------%22%20-ForegroundColor%20Green%0AWrite-Host%20(%22%20%26gt%3B%26gt%3B%26gt%3B%20writing%20to%20file%20%7B0%7D%22%20-f%20%24fileName)%20-ForegroundColor%20Green%0A%24data%20%7C%20Export-csv%20%24fileName%20-NoTypeInformation%20-enc%20utf8%20%0AWrite-host%20%22%20-----------------------------------------%22%20-ForegroundColor%20Green%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%3CSPAN%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20display%3A%20inline%3B%20float%3A%20none%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EYou%20can%20adapt%20that%20script%20as%20you%20need%2C%20based%20on%20your%20own%20requirements%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20font-weight%3A%20bold%3B%22%3EFabrice%20Romelard%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20font-weight%3A%20bold%3B%22%3E%3CEM%20style%3D%22box-sizing%3A%20border-box%3B%22%3EFrench%20version%3A%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20clear%3A%20left%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20list-style-image%3A%20none%3B%20list-style-position%3A%20outside%3B%20list-style-type%3A%20disc%3B%20margin-bottom%3A%2012px%3B%20margin-top%3A%200px%3B%20orphans%3A%202%3B%20padding-left%3A%2040px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%0A%3CLI%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%3CEM%3E%3CA%20href%3D%22http%3A%2F%2Fblogs.developpeur.org%2Ffabrice69%2Farchive%2F2019%2F04%2F26%2Foffice-365-script-powershell-pour-auditer-l-usage-de-microsoft-teams-de-votre-tenant.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fblogs.developpeur.org%2Ffabrice69%2Farchive%2F2019%2F04%2F26%2Foffice-365-script-powershell-pour-auditer-l-usage-de-microsoft-teams-de-votre-tenant.aspx%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%3CSPAN%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20display%3A%20inline%3B%20float%3A%20none%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20italic%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20bold%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3ESource%20used%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20clear%3A%20left%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20list-style-image%3A%20none%3B%20list-style-position%3A%20outside%3B%20list-style-type%3A%20disc%3B%20margin-bottom%3A%2012px%3B%20margin-top%3A%200px%3B%20orphans%3A%202%3B%20padding-left%3A%2040px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Fmsunified.net%2F2018%2F01%2F31%2Fhow-i-create-microsoft-teams-in-powershell-in-january-2018%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmsunified.net%2F2018%2F01%2F31%2Fhow-i-create-microsoft-teams-in-powershell-in-january-2018%2F%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Fwww.jijitechnologies.com%2Fblogs%2Fcreate-teams-microsoft-teams-powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.jijitechnologies.com%2Fblogs%2Fcreate-teams-microsoft-teams-powershell%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FMicrosoftTeams%2F0.9.5%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FMicrosoftTeams%2F0.9.5%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Fblogs.technet.microsoft.com%2Fskypehybridguy%2F2017%2F11%2F07%2Fmicrosoft-teams-powershell-support%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fblogs.technet.microsoft.com%2Fskypehybridguy%2F2017%2F11%2F07%2Fmicrosoft-teams-powershell-support%2F%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Fwww.c-sharpcorner.com%2Farticle%2Fcontrol-microsoft-teams-using-powershell%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.c-sharpcorner.com%2Farticle%2Fcontrol-microsoft-teams-using-powershell%2F%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-Teams%2FMicrosoft-Teams-Tenant-Wide-CSV-Report%2Ftd-p%2F151875%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-Teams%2FMicrosoft-Teams-Tenant-Wide-CSV-Report%2Ftd-p%2F151875%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Fwww.petri.com%2Fteams-powershell-primer%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.petri.com%2Fteams-powershell-primer%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Fpractical365.com%2Fteams-2%2Fcreate-custom-reports-using-the-updated-teams-powershell-module%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpractical365.com%2Fteams-2%2Fcreate-custom-reports-using-the-updated-teams-powershell-module%2F%3C%2FA%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-484713%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAudit%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETeams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-688926%22%20slang%3D%22en-US%22%3ERe%3A%20PowerShell%20script%20to%20export%20Microsoft%20Teams%20Usage%20in%20CSV%20format%20used%20to%20Audit%20an%20Office%20365%20Tena%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-688926%22%20slang%3D%22en-US%22%3E%3CP%3Eios%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F41125%22%20target%3D%22_blank%22%3E%40Fabrice%20Romelard%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

After the previous scripts published to audit an Office 365 Tenant:

 

This script is now dedicated to Microsoft Teams case. 

 

Import-Module MSOnline
Import-Module MicrosoftTeams

[string]$ReportPath = ".\Reports\"
[string]$username = "Admin@yourtenant.onmicrosoft.com"
[string]$PwdTXTPath = "C:\SECUREDPWD\ExportedPWD-$($username).txt"
$secureStringPwd = ConvertTo-SecureString -string (Get-Content $PwdTXTPath)
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $secureStringPwd

$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $session

#Connect-MicrosoftTeams -Credential $cred
Connect-MicrosoftTeams 

[int]$i = 1;
$data = @()
[string]$ListOfChannelNames = ""
[string]$TeamOwnersEmails = ""
[string]$TeamMembersEmails = ""
[string]$TeamGuestsEmails = ""

$ListOfTeams = Get-Team  -user $username #Test command to focus
#$ListOfTeams = Get-Team

Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor Magenta


foreach($MyTeams in $ListOfTeams)
{
	Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green

	$TeamUnifiedGroup = Get-UnifiedGroup -Identity $MyTeams.GroupId
	Write-Host "    ===-> Teams GroupID:", $MyTeams.GroupId, "- Name:", $MyTeams.DisplayName, "- Description:", $MyTeams.Description  -ForegroundColor Yellow
	Write-Host "    ===-> GroupEmail:", $TeamUnifiedGroup.PrimarySmtpAddress

	# Current Teams Configuration implemented
	Write-Host "    ===-> Get-TeamMemberSettings:" -ForegroundColor Yellow
    $TeamMemberSettings = Get-TeamMemberSettings -GroupId $MyTeams.GroupId
	Write-Host "          ====> ", $TeamMemberSettings.AllowCreateUpdateChannels

    Write-Host "    ===-> Get-TeamMessagingSettings:" -ForegroundColor Yellow
    $TeamMessagingSettings = Get-TeamMessagingSettings -GroupId $MyTeams.GroupId
	Write-Host "          ====> ", $TeamMessagingSettings.AllowUserEditMessages

    Write-Host "    ===-> Get-TeamGuestSettings:" -ForegroundColor Yellow
    $TeamGuestSettings = Get-TeamGuestSettings -GroupId $MyTeams.GroupId
	Write-Host "          ====> ", $TeamGuestSettings.AllowCreateUpdateChannels

    Write-Host "    ===-> Get-TeamFunSettings:" -ForegroundColor Yellow
    $TeamFunSettings = Get-TeamFunSettings -GroupId $MyTeams.GroupId
	Write-Host "          ====> ", $TeamFunSettings.AllowGiphy

	$ListOfChannelNames = ""
	$TeamOwnersEmails = ""
	$TeamMembersEmails = ""
	$TeamGuestsEmails = ""
    $CurrentListOfChannelList = Get-TeamChannel -GroupId $MyTeams.GroupId
    foreach($MyChannel in $CurrentListOfChannelList)
    {
	    Write-host "      ------------------ " -ForegroundColor green
	    Write-Host "      ===-> Channel Name:", $MyChannel.Id, "- Name:", $MyChannel.DisplayName, "- Description:", $MyChannel.Description  -ForegroundColor Magenta
        $ListOfChannelNames += " -|- "+ $MyChannel.DisplayName
    }

    $TeamUsers = Get-TeamUser -GroupId $MyTeams.GroupId
    Write-Host "    ===-> Get-TeamUser:", $TeamUsers.Count -ForegroundColor Yellow
	if ([array]$MyTeamGuest = $TeamUsers | Where {$_.Role -eq "guest"})
	{
		$TeamGuestsCount = $MyTeamGuest.Count
		$MyTeamGuest.ForEach({ $TeamGuestsEmails += "|"+ $_.User  })
		Write-Host "       ===-> TeamGuestsEmails:", $TeamGuestsEmails -ForegroundColor Magenta
    }
	else
	{
		$TeamGuestsCount = 0
		$TeamGuestsEmails = ""
    }

	if ([array]$MyTeamMembers = $TeamUsers | Where {$_.Role -eq "member"})
	{
		$TeamMembersCount = $MyTeamMembers.Count
		$MyTeamMembers.ForEach({ $TeamMembersEmails += "|"+ $_.User  })
		Write-Host "       ===-> TeamMembersEmails:", $TeamMembersEmails -ForegroundColor Magenta
    }
	else
	{
		$TeamMembersCount = 0
		$TeamMembersEmails = ""
    }

	if ([array]$MyTeamOwners = $TeamUsers | Where {$_.Role -eq "owner"})
	{
		$TeamOwnersCount = $MyTeamOwners.Count
		$MyTeamOwners.Foreach({ $TeamOwnersEmails += "|"+ $_.User  })
		Write-Host "       ===-> TeamOwnersEmails:", $TeamOwnersEmails -ForegroundColor Magenta
    }
	else
	{
		$TeamOwnersCount = 0
		$TeamOwnersEmails = ""
    }

#Team name	TeamMail	Channels	MembersCount	OwnersCount	GuestsCount	Privacy

	$data += @(
		[pscustomobject]@{
		GroupID = $MyTeams.GroupId
		GroupTeamMail = $TeamUnifiedGroup.PrimarySmtpAddress
		GroupHiddenfromOutlook = $TeamUnifiedGroup.HiddenFromExchangeClientsEnabled
		GroupAccessType = $TeamUnifiedGroup.AccessType
		GroupExternalMemberCount = $TeamUnifiedGroup.GroupExternalMemberCount
		TeamName = $MyTeams.DisplayName
		TeamDescription = $MyTeams.Description
		TeamMemberSettingsAllowCreateUpdateChannels = $TeamMemberSettings.AllowCreateUpdateChannels
		TeamMemberSettingsAllowDeleteChannels = $TeamMemberSettings.AllowDeleteChannels
		TeamMemberSettingsAllowAddRemoveApps = $TeamMemberSettings.AllowAddRemoveApps
		TeamMemberSettingsAllowCreateUpdateRemoveTabs = $TeamMemberSettings.AllowCreateUpdateRemoveTabs
		TeamMemberSettingsAllowCreateUpdateRemoveConnectors = $TeamMemberSettings.AllowCreateUpdateRemoveConnectors
		TeamMessagingSettingsAllowUserEditMessages = $TeamMessagingSettings.AllowUserEditMessages
		TeamMessagingSettingsAllowUserDeleteMessages = $TeamMessagingSettings.AllowUserDeleteMessages
		TeamMessagingSettingsAllowOwnerDeleteMessages = $TeamMessagingSettings.AllowOwnerDeleteMessages
		TeamMessagingSettingsAllowTeamMentions = $TeamMessagingSettings.AllowTeamMentions
		TeamMessagingSettingsAllowChannelMentions = $TeamMessagingSettings.AllowChannelMentions
		TeamGuestSettingsAllowCreateUpdateChannels = $TeamGuestSettings.AllowCreateUpdateChannels
		TeamGuestSettingsAllowDeleteChannels = $TeamGuestSettings.AllowDeleteChannels
		TeamFunSettingsAllowGiphy = $TeamFunSettings.AllowGiphy
		TeamFunSettingsGiphyContentRating = $TeamFunSettings.GiphyContentRating
		TeamFunSettingsAllowStickersAndMemes = $TeamFunSettings.AllowStickersAndMemes
		TeamFunSettingsAllowCustomMemes = $TeamFunSettings.AllowCustomMemes
		TeamChannelsCount = $CurrentListOfChannelList.Count
		TeamChannelsNames = $ListOfChannelNames
		TeamOwnersCount = $TeamOwnersCount
		TeamOwnersEmails = $TeamOwnersEmails
		TeamMembersCount = $TeamMembersCount
		TeamMembersEmails = $TeamMembersEmails
		TeamGuestsCount = $TeamGuestsCount
		TeamGuestsEmails = $TeamGuestsEmails
		}
	)


	Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green
}

Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green

$datestring = (get-date).ToString("yyyyMMdd-hhmm")
$fileName = Join-Path -Path $ReportPath  -ChildPath $("O365-TeamsDetails_"+ $datestring + ".csv")
	
Write-host " -----------------------------------------" -ForegroundColor Green
Write-Host (" >>> writing to file {0}" -f $fileName) -ForegroundColor Green
$data | Export-csv $fileName -NoTypeInformation -enc utf8 
Write-host " -----------------------------------------" -ForegroundColor Green

 

You can adapt that script as you need, based on your own requirements

 

Fabrice Romelard

 

French version:

Source used:

 

1 Reply