0 votes

Forgive me if this topic has been discussed elsewhere i searched and didn't find anything.

What I would like to have adaxes do is on a nightly basis

1. go to a folder it will have access to which will have a file that contains the alias name(s) of an employee(s).
2. for the people in the file their account should be disabled by adaxes.
3. the description should read "disabled by adaxes on %getdate%"
4. send an email saying user x was disabled or user x was not found. (its fine to do one email a person it will be 2 or 3 at most or one email with everyone is fine as well)
5. move the file to a completed folder or possibly just delete it once everything is worked out.
6. do not disable any user with _adm in its name
7. do not parse file if it has over 20 entries.
8. do not disable/change description if its already disabled ( to avoid changing the date of the description if the same user is in next day file accidentally.

Ive been looking at scheduled tasks but it seems like im going to need to run a powershell script rather than use the gui bits. I can get it to do the actions aside from looking at a file from what i can se (so steps 2,3 and 4 seem doable from the gui anyway.)

for powershell something like this perhaps:

Import-Module ActiveDirectory
[string]$date = Get-Date -Format g
Import-Csv "d:\csv\test.csv" | ForEach-Object {
$samAccountName = $_."samAccountName"
Get-ADUser -Identity $samAccountName | Disable-ADAccount
set-ADUser -Identity $samAccountName -description "disabled by adaxes $date"
}

Is this possible #4 eludes me a bit.
Thank you in advance.

by (50 points)

1 Answer

0 votes
by (270k points)
selected by
Best answer

Hello,

You need to use a PowerShell script. For details, have a look at the following script from our repository: https://www.adaxes.com/script-repositor ... e-s246.htm. If you have issues updating the script to meet your needs, we will help you.

Related questions

0 votes
1 answer

Hi we are trying to add users to a group based on the values of their "Office" and "Description" attributes within Active Directory. We have populated the below ... $Context.LogMessage("No matching criteria found for User $($Context.TargetObject.Name).") }

asked Sep 18, 2023 by Loopy8822 (20 points)
0 votes
1 answer

We are working with an HR package that will send us a CSV file every 4 hours with a list of users that need to be created, modified or deleted from our environment. The CSV ... change, etc.) Is there a script that can manage all of that on a scheduled basis?

asked Sep 2, 2020 by RayBilyk (230 points)
0 votes
0 answers

Before Deactivation of an Account on the Webinterface our Help Desk need to change the AD User Description manually. Is it possible to force a manual change before deactivation ?

asked Feb 7, 2020 by lv01 (20 points)
0 votes
0 answers

I have a deprovision task that our desktop support staff uses to terminate a user and want to setup a scheduled task that goes through and looks for users who are past their ... to the current date it is still applied to ALL users in the organization. Why?

asked May 16, 2013 by trscott (80 points)
0 votes
1 answer

Hi: I am trying to create a business rule that will stop a value change based on the existing value. For example, if the telephonenumber is 1234 for a group and has to ... the value it uses is the incoming value of the change, not the existing value. Thanks!

asked Jun 3, 2022 by crobitaille (80 points)
3,326 questions
3,026 answers
7,727 comments
544,681 users