当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 获取所有包含成员和所有者的 Microsoft 团队组

作者:精品下载站 日期:2024-12-14 07:11:59 浏览:15 分类:玩电脑

获取所有包含成员和所有者的 Microsoft 团队组


更新 29/03/2020:本文有效,但现在 Teams 模块已重新启动,可以做更多事情。请参阅我后面的文章:https://blog.it-koehler.com/en/Archive/2074

注意:以下操作仅显示在团队中创建的团队群组,不会显示转换后的 O365 群组。
有关 HTML 报告,请查看评论!

$teamsgroups = (Get-UnifiedGroup | Where-Object {($_.ProvisioningOption -eq "ExchangeProvisioningFlags:481") -or ($_.ProvisioningOption -eq "ExchangeProvisioningFlags:3552") }

由于运行后返回的对象较多,所以我选择了“select”进行过滤。

$teamsgroups = (Get-UnifiedGroup | Where-Object {($_.ProvisioningOption -eq "ExchangeProvisioningFlags:481") -or ($_.ProvisioningOption -eq "ExchangeProvisioningFlags:3552") } | Select-Object DisplayName,Alias,ProvisioningOption,SharePointSiteUrl,SharePointDocumentsUrl,AccessType,Language,ExchangeGuid,ManagedBy)

这样就可以显示团队用户创建的所有O365群组了。
还不错。
现在我还想显示群组成员。

Get-UnifiedGroupLinks -Identity 
 -LinkType Members

就不是很困难。
因此,将这两个步骤结合在一起并不像看起来那么容易。
为此,我构建了以下 Powershell 脚本。

<#
    .SYNOPSIS

    script for showing all office 365 groups created by microsoft teams

    .DESCRIPTION
    


    .EXAMPLE
    no parameters needed 

    .Notes
    connect to exchange online first 
    https://technet.microsoft.com/en-us/library/jj984289(v=exchg.160).aspx
    or see https://blog.it-koehler.com/en/Archive/1589
  
    ---------------------------------------------------------------------------------
                                                                                 
    Script:       get-allteams-withmembers-0-1.ps1                                      
    Author:       A. Koehler; blog.it-koehler.com
    ModifyDate:   18/03/2018                                                        
    Usage:        identify all teams groups in office 365 and get members
    Version:      0.1
                                                                                  
    ---------------------------------------------------------------------------------
#>

#get all groups created with ms teams (filtered ExchangeProvisioningFlag:481)
#raw powershell command: Get-UnifiedGroup | Where-Object {$_.ProvisioningOption -eq "ExchangeProvisioningFlags:481" } | fl
$teamsgroups = (Get-UnifiedGroup | Where-Object {($_.ProvisioningOption -eq "ExchangeProvisioningFlags:481") -or ($_.ProvisioningOption -eq "ExchangeProvisioningFlags:3552") } | Select-Object DisplayName,Alias,ProvisioningOption,SharePointSiteUrl,SharePointDocumentsUrl,AccessType,Language,ExchangeGuid,ManagedBy) 
#notification for powershell
Write-Host "Getting Office 365 Groups created with MS Teams... " -ForegroundColor Green
#generate array for teamsgroups
$teams = @()
#loop to get information
ForEach ($group in $teamsgroups){
  #get-members of group
  $identity = (($group).ExchangeGuid)
  $members = (Get-UnifiedGroupLinks -Identity "$identity" -LinkType Members | Select-Object PrimarySMTPAddress) 
  $owners = (Get-UnifiedGroupLinks -Identity "$identity" -LinkType Owners | Select-Object PrimarySMTPAddress)   
  $member = (($members).primarySMTPAddress) | Out-String -Width 4096
  $owner = (($owners).primarySMTPAddress) | Out-String
  # Adding pscustomobjets entries to array
  $teams += [pscustomobject]@{
    DisplayName   = ($group).DisplayName
    Alias    = ($group).Alias
    AccessType = ($group).AccessType
    Language = ($group).Language
    Members = ("$member")
    Owner = ("$owner")
  }
}
#out put in GridView (external window)
Write-Host "Display in Grid View Window " -ForegroundColor Green
$teams | Out-GridView -Title "All Office365 Groups created in MS Teams" 
#out put in powershell
#$teams | Format-Table -AutoSize -Wrap  
#erase content of variables
$teams =$null
$member = $null

[玩转系统] 获取所有包含成员和所有者的 Microsoft 团队组

[玩转系统] 获取所有包含成员和所有者的 Microsoft 团队组

这会读取所有包含成员以及当前经理/所有者的群组。 我们我们可以概览公司内当前的团队群组。
欢迎批评和反馈。
祝测试愉快。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯