Get-MgmtGraphContactManager
MgmtGraph: Audits the manager of an organizational contact
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Identity.DirectoryManagement
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Identity
)
Process {
try {
$manager = Get-MgContactManager -OrgContactId $Identity -ErrorAction Stop
if ($manager) {
$result = [PSCustomObject]@{
ContactId = $Identity
DisplayName = $manager.AdditionalProperties.displayName
Type = $manager.AdditionalProperties.'@odata.type'.Replace('#microsoft.graph.', '')
Id = $manager.Id
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
}
catch {
throw
}
}Specifies the ID of the organizational contact to audit.