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.