0 votes

I'm looking to run a powershell command using a Custom Command that runs after a tech runs through the Transfer request and it will send an email to me showing me the groups that the user currently has, so I can respond to Tech to show them what groups should be removed.

The command is: Get-ADPrincipalGroupMembership -ResourceContextServer localdomain.com -Identity username| select name

Which will give me all the groups, for that specific user.

by (1.4k points)

1 Answer

0 votes
by (270k points)

Hello,

To send an email in a script executed in Adaxes, you can use the $Context.SendMail method. Also, you can try using Adaxes functionality in the script instead of the cmdlet. The following script from our repository might be helpful: https://www.adaxes.com/script-repository/remove-all-group-memberships-for-a-user-account-s33.htm.

Should you have issues with the script, please, specify what exactly except for the group names should be included into the email. A live example will be very helpful.

Related questions

0 votes
1 answer

I have a powershell scrip that runs as a Action on a custom command, and this scrip calls the ExecuteCustomCommand PS Function on a user. Is there ... .ExecuteCustomCommand($command.CommandID, $commandArguments) And have the result contain the log messages.

asked Jun 17, 2020 by Justinc (60 points)
0 votes
1 answer

Receive "Index operation failed; the array index evaluated to null. Stack trace: at <ScriptBlock>, <No file>: line 104>" and "Index operation failed; the ... $GroupName, $GroupDN." } } #foreach write-output "" Write-Output "" Stop-Transcript

asked Apr 14, 2022 by jbahou (20 points)
0 votes
1 answer

Is there a way to have a Scheduled Task with 4 different condition? I want to create a scheduled task start every Monday and the condition see: The next Saturday of the week ... of the week is the fifth of the month then no action Thanks in advance, Simone

asked Jan 18, 2022 by Simone.Vailati (430 points)
0 votes
1 answer

I need to run a PowerShell on accounts that are 90 days or older. Would that be "if the 'When Created' is greater then or queal to '%datetime,-90d%'" or "if the 'When Created' is less then or queal to '%datetime,-90d%'"

asked Jun 1, 2020 by hgletifer (1.3k points)
0 votes
1 answer

Hi, I need to start Adaxes scheduled task from Powershell console running on another host. How can I do that?

asked May 21, 2020 by KIT (910 points)
3,326 questions
3,025 answers
7,727 comments
544,678 users