Remove-MgmtGraphUserManager
MgmtGraph: Removes the manager relationship for a Microsoft Graph user
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Users
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Identity
)
Process {
try {
$params = @{
'UserId' = $Identity
'Confirm' = $false
'ErrorAction' = 'Stop'
}
Remove-MgUserManagerByRef @params
$result = [PSCustomObject]@{
UserIdentity = $Identity
Action = "UserManagerRemoved"
Status = "Success"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}Specifies the UserPrincipalName or ID of the user whose manager is to be removed.