Skip to content

Get-MSTLicenseReport

Teams: Get license report for change notification subscriptions

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [ValidateSet('7', '30', '90', '180')]
    [string]$Period
)

Process {
    try {
        [hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'Period' = $Period}

        $result = Get-LicenseReportForChangeNotificationSubscription @cmdArgs | Select-Object * | Sort-Object DisplayName

        if ($null -eq $result -or $result.Count -eq 0) {
            Write-Output "No license report data found"
            return
        }
        foreach ($item in $result) {
            $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
        }
    }
    catch { throw }
}

Period of notification events (7, 30, 90, or 180 days)

An interactive directory of PowerShell scripts.