Forum Discussion
elaheh
Mar 10, 2023Brass Contributor
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)"
}