0
votes

I have a powershell script that creates a new team using the New-Team module. This should output the newly created teams GroupID, i don't seem to get this but the Team is created just fine.

The code i'm using is:

$team = New-Team -MailNickname $TeamName -displayname $TeamName -Visibility Private

Write-Host "Team Created: $TeamName" Write-Host "Team GUID: $team.GroupID"

The response i get from $team.GroupID is the following and not the value.

Team GUID: Microsoft.Teams.PowerShell.TeamsCmdlets.Model.TeamSettings.GroupID
1
What does $Team.GroupID |Get-Member show you? - Mathias R. Jessen
I get " Get-Member : You must specify an object for the Get-Member cmdlet." - Nathan

1 Answers

0
votes

You are quoting an object. Try the following:

Write-Host "Team GUID: $($team.GroupID)"

So basically what you are outputting is:

"Team GUID: $team(the complete object) .GroupID(in plain text)"

You could however also do it outside quotes:

Write-Host "Team GUID: " + $team.GroupID