Skip to content

Get-User-Html

Azure AD: HTML report of all users

#Requires -Version 5.1
#Requires -Modules AzureAD

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

Process {
    try {
        $users = Get-AzureADUser -All $true -SearchString $SearchString -ErrorAction Stop | Select-Object DisplayName, ObjectID, UserPrincipalName, AccountEnabled -Unique | Sort-Object -Property DisplayName

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

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

Optional string to filter users

An interactive directory of PowerShell scripts.