Une question basique dans le cadre de la gestion de tenant Office 365 Teams est de connaitre les information pour les Teams sur lequel un utilisateur a les droits.
Une solution est de passer à travers le module PowerShell pour Teams:
Bien que limité dans les options disponibles le script suivant vous permet d’extraire les informations pour un utilisateur donné. Pour cela il vous faudra un compte avec des privilèges élevés et une license Office 365 teams.
Import-Module MicrosoftTeams
#$cred = Get-Credential
#$username = $cred.UserName
#Connect-MicrosoftTeams
#Get-Command -Module MicrosoftTeams[string]$username = "YourAdminAccount@yourdomain.com"
[string]$PwdTXTPath = "C:\SECUREDPWD\ExportedPWD-$($username).txt"
$secureStringPwd = ConvertTo-SecureString -string (Get-Content $PwdTXTPath)
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $secureStringPwdConnect-MicrosoftTeams -Credential $cred
[string]$LoginToUser = "LogintoCheck@yourdomain.com"Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green
Write-Host " => Login to check for the Teams:", $LoginToUser -ForegroundColor Green$ListOfMyTeams = Get-Team -user $LoginToUser
foreach($MyTeams in $ListOfMyTeams)
{
Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green
Write-Host " ===-> Teams Name:", $MyTeams.GroupId, "- Name:", $MyTeams.DisplayName, "- Description:", $MyTeams.Description -ForegroundColor Yellow
Write-Host " ===-> Get-TeamFunSettings:" -ForegroundColor Yellow
Get-TeamFunSettings -GroupId $MyTeams.GroupIdWrite-Host " ===-> Get-TeamGuestSettings:" -ForegroundColor Yellow
Get-TeamGuestSettings -GroupId $MyTeams.GroupIdWrite-Host " ===-> Get-TeamMemberSettings:" -ForegroundColor Yellow
Get-TeamMemberSettings -GroupId $MyTeams.GroupIdWrite-Host " ===-> Get-TeamMessagingSettings:" -ForegroundColor Yellow
Get-TeamMessagingSettings -GroupId $MyTeams.GroupIdWrite-Host " ===-> Get-TeamUser:" -ForegroundColor Yellow
Get-TeamUser -GroupId $MyTeams.GroupId | Format-Table
$MyListOfChannelList = Get-TeamChannel -GroupId $MyTeams.GroupId
foreach($MyChannel in $MyListOfChannelList)
{
Write-host " ------------------ " -ForegroundColor green
Write-Host " ===-> Channel Name:", $MyChannel.Id, "- Name:", $MyChannel.DisplayName, "- Description:", $MyChannel.Description -ForegroundColor Magenta
#$MyChannel | Get-Member
}Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green
}Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green
Si vous souhaitez des options plus avancées, il vous faudra regarder Office Graph pour cela.
Fabrice Romelard
Version Anglaise:
Sources utilisées pour le script:
- https://msunified.net/2018/01/31/how-i-create-microsoft-teams-in-powershell-in-january-2018/
- https://www.jijitechnologies.com/blogs/create-teams-microsoft-teams-powershell
- https://www.powershellgallery.com/packages/MicrosoftTeams/
- https://blogs.technet.microsoft.com/skypehybridguy/2017/11/07/microsoft-teams-powershell-support/
- https://www.c-sharpcorner.com/article/control-microsoft-teams-using-powershell/
Commentaires
Enregistrer un commentaire