Get-MsOUserProperties-Html
MSOnline: HTML report of user properties
#Requires -Version 5.1
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true, ParameterSetName = 'Id')]
[guid]$UserObjectId,
[Parameter(Mandatory = $true, ParameterSetName = 'Name')]
[string]$UserName,
[Parameter(ParameterSetName = 'Name')]
[Parameter(ParameterSetName = 'Id')]
[ValidateSet('*','DisplayName','UserPrincipalName','FirstName','LastName','Department','Title','UsageLocation','Country','City','State','PostalCode','PhoneNumber','MobilePhone','ObjectId')]
[string[]]$Properties = @('DisplayName','UserPrincipalName','Department','Title','ObjectId'),
[guid]$TenantId
)
Process {
try {
if ($PSCmdlet.ParameterSetName -eq 'Id') { $result = Get-MsolUser -ObjectId $UserObjectId -TenantId $TenantId -ErrorAction Stop | Select-Object $Properties }
else { $result = Get-MsolUser -SearchString $UserName -TenantId $TenantId -ErrorAction Stop | Select-Object $Properties }
if ($null -eq $result -or $result.Count -eq 0) { Write-Output "No user found"; return }
Write-Output ($result | ConvertTo-Html -Fragment)
}
catch { throw }
}Unique ID of the user
Display name, Sign-In Name or UPN of the user
List of properties to expand. Use * for all
Unique ID of the tenant