0 votes

Hello,

We want users to be removed from critical groups when account is disabled. Is it possible to do this with Adaxes?

by (100 points)

1 Answer

0 votes
by (216k points)

You can do this easily. You need to create a Business Rule that will be triggered after disabling user accounts. This Business Rule will automatically remove disabled users from the groups you specify.

For more details, please see Add Users to a Specific Group When They are Disabled.

Alternatively, if you want to remove disabled users from all groups except the primary group (Domain Users), you can add Run a program or PowerShell script action to your Business Rule that will execute the following PowerShell script:

Import-Module Adaxes
$user = Get-AdmUser "%distinguishedName%" -Properties MemberOf
if ($user.MemberOf -ne $Null)
{
    foreach ($groupDN in $user.MemberOf)
    {
        Remove-AdmGroupMember $groupDN -Members $user  -Confirm:$False
    }
}
0

I'm using your script for a scheduled task that is running everyday to clean up the disabled users.
Would it be possible to adjust the script in way that I do receive an email notification including all users that it has touched?

kind regards
Ingemar Jacob

0

Hello Jacob,

Do you want a separate email for each user that the task has touched or a summary email containing all users? Sending separate emails is better from the point of view of performance and will require only a slight modification of the script.

If you want a summary email for all users, that can also be done, however you need to keep in mind that you'll need to perform all actions on all users within a single script. That is, you'll need a script that will find all user accounts that need to be cleaned up, perform the necessary operations on each of them, and then send a summary report. This will require binding to each user within the script, that can take quite a lot of time if there are many users that you need to clean up.

Which of the options suits your needs best?

0

sorry for getting back to you that late. One mail per user would be okay for now instead of a summary

0

Hello Jacob,

Use the 3rd (last) version of the script in the following article in our Script Repository: Remove all group memberships for a user account.

Related questions

0 votes
1 answer

Is there a way that anyone has been able to figure out to remove users no longer with the company from groups like ServiceNow? All ServiceNow groups in my environment ... Security Groups,DC=Domain,DC=Name,DC=org Any help would be greatly appreciated! -Dale

asked Oct 18, 2017 by felt1977 (120 points)
0 votes
1 answer

https://www.adaxes.com/script-repository/remove-all-group-memberships-for-a-user-account-s33.htm I found this script but it only removes 365 groups, security groups, and ... user from all shared mailboxes they are a member of when disabling a user. Thanks!

asked Sep 8, 2023 by silicondt (60 points)
0 votes
1 answer

I am using this script to remove all users from groups when they are terminated. This script doesn't remove users from Azure only groups just on prem. How would I change ... .LogMessage("Can not remove $U from $GN"+$_.Exception.Message, "Information") } }

asked Jun 18 by mightycabal (1.0k points)
0 votes
1 answer

I would like to have a script that removes the offboarded users from all teams groups

asked Jan 3 by bodson (20 points)
0 votes
1 answer

Hello! how do i manage do get adaxes to remove all groups from the user after one month? We have a Business Rule where you can add an end of Date when the Account ... value field the powershell script works but not with the +1 Month. Thanks for your help!

asked Jun 14, 2023 by eww ag (140 points)
3,504 questions
3,196 answers
8,148 comments
547,431 users