For all our shared mailbox in Exchange we create security groups to manage the sendas, send on behalf and full access permissions.
Users go via the web interface and select the mailboxes and relevant permissions through tick boxes which we are defining as parameters.
I have a script to add users to the specific security groups which mostly are on-premises but some of the groups now exist in M365 as we are moving the management to there.
I have added the M365 tenant as a managed domain. Does the get-admgroup powershell command allow you to get the groups from the cloud managed domain as this would mean my scripts do not require updating.
Here is an example of my script
$mailbox ="%param-Mailbox%" -replace "(CN=)(.*?),.*",'$2'
if ("%param-Sendas%" -eq "Yes")
{
$mailboxrights = $mailbox + "_SendAs"
$mailboxGroup = Get-AdmGroup $mailboxrights
Add-AdmGroupMember $mailboxGroup "%distinguishedName%" -AdaxesService localhost -ErrorAction SilentlyContinue
$mailboxrights2 = $mailbox + "_FullAccess"
$mailboxGroup2 = Get-AdmGroup $mailboxrights2
Add-AdmGroupMember $mailboxGroup2 "%distinguishedName%" -AdaxesService localhost -ErrorAction SilentlyContinue
}
If the command no longer works which one should I now use?
Unless there is a better approach I am open to ideas.