Skip to content

Get-Group-Html

Azure AD: HTML report of all groups

#Requires -Version 5.1
#Requires -Modules AzureAD

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

Process {
    try {
        $groups = Get-AzureADGroup -All $true -SearchString $SearchString -ErrorAction Stop | Sort-Object -Property DisplayName

        if ($null -eq $groups -or $groups.Count -eq 0) {
            Write-Output "No groups found"
            return
        }

        $rows = foreach ($g in $groups) {
            [PSCustomObject]@{ DisplayName = $g.DisplayName; Description = $g.Description; Mail = $g.Mail; ObjectId = $g.ObjectId }
        }

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

Optional string to filter groups by display name

An interactive directory of PowerShell scripts.