Forum Discussion

elaheh's avatar
elaheh
Brass Contributor
Mar 10, 2023

Powershell to get group id from a list of display name in ms teams

Hi, 

I'm looking for a Powershell to get group id from a list of display names in ms teams.

I have a list of specific Teams display names and looking for their group id on the whole tenant.

Is there any way to get this?

 

 

 

 

 

  • You can try the below PowerShell script to get the group is from MS Teams

    # Import the Microsoft Teams PowerShell module
    Import-Module MicrosoftTeams

    # Set the list of group display names you want to retrieve IDs for
    $groupNames = "Group 1", "Group 2", "Group 3"

    # Loop through each group name and retrieve the corresponding group object
    foreach ($groupName in $groupNames) {
    $group = Get-Team -DisplayName $groupName

    # Output the group's display name and ID
    Write-Host "Group Name: $($group.DisplayName) Group ID: $($group.GroupId)"
    }
  • You can try the below PowerShell script to get the group is from MS Teams

    # Import the Microsoft Teams PowerShell module
    Import-Module MicrosoftTeams

    # Set the list of group display names you want to retrieve IDs for
    $groupNames = "Group 1", "Group 2", "Group 3"

    # Loop through each group name and retrieve the corresponding group object
    foreach ($groupName in $groupNames) {
    $group = Get-Team -DisplayName $groupName

    # Output the group's display name and ID
    Write-Host "Group Name: $($group.DisplayName) Group ID: $($group.GroupId)"
    }
    • elaheh's avatar
      elaheh
      Brass Contributor
      btw, I have the list of display name in .CSV file.
    • elaheh's avatar
      elaheh
      Brass Contributor
      Thanks for the quick reply. I will try. 🙂

Resources