Script Repository


Remove object from group after being added to another group

March 17, 2021
1508

You can use the following script to remove an AD object from a group after it has been added to another group. To use it with Adaxes, you need to create a business rule triggered after adding a member to a group. Use the Run a program or PowerShell script action to execute the script.

Parameters:

  • $groupDN - specifies the distinguished name (DN) of the group to remove the user from.
Edit Remove
PowerShell
$groupDN = "CN=Group1,CN=Users,DC=example,DC=com" # TODO: modify me

$objectPath = "Adaxes://%member%"

$group = $Context.BindToObjectByDN($groupDN)
$group.Remove($objectPath)

Comments ( 0 )
No results found.
Leave a comment

Related Scripts