Get-O365GroupProperty
Azure AD: Retrieves all properties of a group
#Requires -Version 5.1
#Requires -Modules AzureAD
[CmdletBinding(DefaultParameterSetName = "GroupName")]
Param(
[Parameter(Mandatory = $true, ParameterSetName = "GroupObjectId")]
[guid]$GroupObjectId,
[Parameter(Mandatory = $true, ParameterSetName = "GroupName")]
[string]$GroupName
)
Process {
try {
if ($PSCmdlet.ParameterSetName -eq "GroupObjectId") {
$grp = Get-AzureADGroup -ObjectId $GroupObjectId -ErrorAction Stop | Select-Object *
}
else {
$grp = Get-AzureADGroup -All $true -ErrorAction Stop | Where-Object { $_.Displayname -eq $GroupName } | Select-Object *
}
if ($null -eq $grp) { throw "Group not found" }
$grp | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force
}
catch { throw }
}Unique object ID of the group
Display name of the group