Skip to content

Get-MSTPolicyPackage-Html

Teams: HTML report of all policy packages available

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [string]$Identity
)

Process {
    try {
        [hashtable]$getArgs = @{'ErrorAction' = 'Stop'}

        if (-not [System.String]::IsNullOrWhiteSpace($Identity)) {
            $getArgs.Add('Identity', $Identity)
        }

        $packages = Get-CsPolicyPackage @getArgs | Select-Object Name, Description, PackageType
        $result = @()
        foreach ($pkg in $packages) {
            $result += [PSCustomObject]@{
                Name        = $pkg.Name
                Description = $pkg.Description
                PackageType = $pkg.PackageType
            }
        }

        if ($result.Count -eq 0) {
            Write-Output "No policy packages found"
            return
        }

        Write-Output ($result | ConvertTo-Html -Fragment)
    }
    catch { throw }
}

The name of a specific policy package to retrieve

An interactive directory of PowerShell scripts.