Hello

I was looking for some assistance with this command. I can not get this command below to work. I have tried two ways, and neither removed the account from the specified group. I've tried the group Distinguished name as well for Identity.

Remove-AdmGroupMember -Identity "%sAMAccountName%" -Members "%adm-InitiatorDN%" -confirm:$false -AdaxesService localhost
#$DistGroupDN = "%sAMAccountName%"
#$UserDN = "%adm-InitiatorDN%"

Remove-AdmGroupMember -Identity "$DistGroupDN" -Members "$UserDN" -confirm:$false -AdaxesService domain.com
ago by (410 points)
ago by (308k points)
0

Hello,

Where are you executing the script? Is it in Windows PowerShell or in Adaxes? If it is in Adaxes, please, post here or send us (support@adaxes.com) a screenshot of the custom command, business rule or scheduled task executing the script.

ago by (410 points)
0

I've got it in a Business Rule as an action under an Else if condition. The other two actions work without issues.

image.png

image.png

1 Answer

ago by (308k points)
+1 vote

Hello,

Thank you for the provided details. The first approach should work fine, but it might be required to add the -Server parameter:

Remove-AdmGroupMember -Identity "%sAMAccountName%" -Members "%adm-InitiatorDN%" -confirm:$false -AdaxesService localhost -Server "dc.domain.com"

Also, you can use the below approach that will definitely work.

$Context.TargetObject.Remove("Adaxes://%adm-InitiatorDN%")
ago by (410 points)
0

The top script with "-Server" specified did the trick.

I will keep your bottom script in the back of my pocket.

Thank you!!!

Related questions

HI Support, I'm looking for a business Rule that remove a user from a couple of groups after the User is added to a group. ie 1. The User MaxMi is added to the ... not able to create a powershell scripts for removing the added user from the other Groups. Thx,

asked Jan 4, 2016 by Napoleon (700 points)
0 votes
1 answer

I'd like some help with a script to revoke a users rights to a shared mailbox upon being removed from a security group. I already have the reverse, a script that adds users to a shared mailbox, if they are a member of a group, now I just need the reverse.

asked Mar 20, 2024 by dominik.stawny (280 points)
0 votes
1 answer

Hi , i have move action I want ADAXES to Remove user from group named like this ADG1 and add user to ADG2 if user moved from OU ADG1 to ADG2 , ... member of group named like this shift_check_in_1 i want to remove and add anohter group named shift_check_in_2

asked Dec 5, 2024 by vagifazari (470 points)
0 votes
1 answer

Every role-based-group starts with "arbg-" Users should only be in 1 arbg- group To enforce this, on any user change I would like to remove them from any " ... Get-ADPrincipalGroupMembership -Identity | Select Name | Where-Object {$_.Name -Like 'ARBG*'}

asked Apr 29, 2022 by stevehalvorson (150 points)
0 votes
1 answer

In the de-provisioning process, I need to remove all users from all Office 365 groups (UnifiedGroups). I tried to adapt this script but unsuccessfully. https://www.adaxes.com/script-repositor ... -s360.htm Is there any way to do this?

asked Sep 22, 2019 by flaviodouglas (70 points)
0 votes
1 answer