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 the...
- Mar 10, 2023You 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)"
}
eliekarkafy
Mar 10, 2023MVP
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)"
}
# 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
Mar 10, 2023Brass Contributor
btw, I have the list of display name in .CSV file.
- eliekarkafyMar 10, 2023MVPso, did you retrieve the group id using the script?