The script updates the adm-ManagedByList property with values of msExchCoManagedByLink. To execute the script, create a custom command, business rule or scheduled task configured for the User object type.
PowerShell
$allDNs = New-Object "System.Collections.Generic.HashSet[String]"
try
{
# Get msExchCoManagedByLink property values
$exchangeOwners = $Context.TargetObject.GetEx("msExchCoManagedByLink") | %%{[void]$allDNs.Add($_)}
}
catch
{
# The msExchCoManagedByLink property is empty
return
}
try
{
# Get Adaxes secondary owners
$adaxesOwners = $Context.TargetObject.GetEx("adm-ManagedByList") | %%{[void]$allDNs.Add($_)}
}
catch
{
# The adm-ManagedByList property is empty
}
# Update Adaxes secondary owners
$Context.TargetObject.Put("adm-ManagedByList", @($allDNs))
$Context.TargetObject.SetInfo()