0 votes

Hello,

I want to include in a sent email notification after removing a member from a group the active directory user property "company" and "co" of a user. How can I achieve this? I can not select a property %adm-membercompany% nor %adm-memberco"

2024-06-07 15_53_01-Remote Desktop Manager \[adm001.rubnergroup.local\].png

by (380 points)
edited by

1 Answer

0 votes
by (13.8k points)

Hello,

This is something that can only be done using a PowerShell script. Please, find an example of such a script below. In the script: $to – Specifies email addresses of the notification recipients. $subject – Specifies the email notification subject. $emailBodyTemplate – Specifies the email notification template. In the template, the {0} placeholder will be replaced with the value of the Country property, {1} – with the value of the Company property.

$to = "recipient@company.com, recipient2@company.com" # TODO: modify me
$subject = "My Subject" # TODO: modify me
$emailBodyTemplate = @"
Hello,

The user %adm-MemberFullName% was removed from the %name% group.

Removed member properties:
Country: {0};
Company: {1}
"@ # TODO: modify me

# Get member property value
$member = $Context.BindToObjectByDN("%member%")

try
{
    $memberCountryPropertyValue = $member.Get("c")
    $memberCompanyPropertyValue = $member.Get("company")
}
catch
{}

# Send mail
$emailBody = [System.String]::Format($emailBodyTemplate, @($memberCountryPropertyValue, $memberCompanyPropertyValue))
$Context.SendMail($to, $subject, $emailBody, $NULL)

Related questions

0 votes
0 answers

Is it possible to trigger an action 'after removing a member from a group' unless that member is a member of another group? For example I have two security groups: 'DS Senders' and ... 'DS Senders' but not if they are a member of 'DS Viewers', and vice versa.

asked Oct 26, 2021 by bavery (250 points)
0 votes
1 answer

Hello, I am attempting to configure a business rule that adjusts an adaxes custom property of a user, upon that user being added/removed from a group. I cannot seem to ... (like username, office, description, email, etc.) but not so much on custom attributes.

asked Jul 14, 2023 by NKB#2772 (70 points)
0 votes
1 answer

I have a scheduled task that runs a Powershell script against an AD group, "Group 1". I need to get all of the members of Group 1, and add them to Group 2. The ... identity in the error message start with 'user;'? What is the correct way to accomplish this?

asked Aug 27, 2019 by ngb (290 points)
0 votes
1 answer

We are attempting to use the member property in a powershell script for all groups. We get this error message on certain groups that are used as "primary". If we set another ... just shows the single member in the group in which the group is not the primary.

asked Feb 19, 2020 by mark.it.admin (2.3k points)
0 votes
1 answer

Hello, A year ago, in a previous ticket, I inquired about the possibility of mandating that Adaxes users enter a ticket number before adding a member to a ... automatic business rules that facilitate the addition/removal of members from groups. Regards, Fabian

asked Jul 16 by fabian.p (380 points)
3,541 questions
3,232 answers
8,225 comments
547,802 users