Skip to content

Get-MSTTeam-qf

Teams: Query-format list of teams

#Requires -Version 5.1

[CmdletBinding()]
Param()

Process {
    try {
        $teams = Get-Team -ErrorAction Stop | Sort-Object -Property DisplayName

        if ($null -eq $teams -or $teams.Count -eq 0) {
            Write-Output "No teams found"
            return
        }
        foreach ($itm in $teams) {
            [PSCustomObject]@{
                Timestamp    = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
                Value        = $itm.GroupId
                DisplayValue = $itm.DisplayName
            }
        }
    }
    catch { throw }
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.