0 votes

I have tried using this Powershell script but it gives me this error image.png

image.png

by (40 points)

1 Answer

0 votes
by (270k points)

Hello,

The script can only be used in Adaxes 2021.1. Use the below script instead. For the script to work, install the Exchange EXO V2 module on the computer where Adaxes service runs.

Import-Module ExchangeOnlineManagement

$groupNames = @("MyGroup1", "MyGroup2", "MyGroup3")

try
{
    # Get the object ID in Microsoft 365
    $objectId = [Guid]$Context.TargetObject.Get("adm-O365ObjectId")
}
catch
{
    return # The user doesn't have a Microsoft 365 account
}

Connect-ExchangeOnline -Credential $Context.GetOffice365Credential()

foreach ($groupName in $groupNames)
{
    # Add user to group
    try
    {
        Add-DistributionGroupMember $groupName -Member $objectId.ToString() -BypassSecurityGroupManagerCheck -ErrorAction Stop
    }
    catch
    {
        $Context.LogMessage("An error occurred when adding the user to $groupName group. Error: " + $_.Exception.Message, "Warning")
    }
}

Related questions

0 votes
1 answer

Hi All, I was following the following documentation https://www.adaxes.com/tutorials_DelegatingPermissions_GrantRightsToModifyADGroupMembership.htm However I cannot work out how to make it ... can only add themselves. Any help would be great. Many Thanks

asked Mar 30, 2020 by antondubek (440 points)
0 votes
1 answer

Hi Guys, You probably already met with a similar problem in your organization. Communications Department has dozens of distribution groups, that need to be updtaed base on some ... do the job. Maybe you can share some better solution to achieve same goal.

asked Mar 9, 2015 by axmaster (510 points)
0 votes
0 answers

Is it possible to do something such as this: When creating a user in the web interface, setup the form so that certain fields have a dropdown list of available values, ... "department", they would see a dropdown list of pre-populate options to choose from.

asked Aug 11, 2016 by HDClown (220 points)
0 votes
0 answers

We have a multiforest set up. One of the domains is a non hybrid. Whenever a user is created in that domain it gives an error saying- 'Property 'ms-exch-target- ... active Directory schema'. How can we write an exception while adding to that non-hybrid domain?

asked Oct 31, 2022 by Aishwarya Gavali (40 points)
0 votes
1 answer

They can navigate to both the user or the group within the ADAXES web interface without issue. They can then either Add to Group or Add Member but the resulting ... something to the web interface which prevents changing the lookup domain. Any ideas? Thanks!

asked Apr 9, 2020 by VTPatsFan (610 points)
3,326 questions
3,026 answers
7,727 comments
544,681 users