#
Employee-Departure-Reconciliation.ps1
Purpose Dependencies Function Usage Inputs Variables Command Line Flags Outputs Notes
#
Purpose
Automates the reconciliation of a single departed employee in Active Directory using a CSV file from People Services. Validates if the person is still active, disables the account if needed, logs actions, and provides clear instructions for ICT follow-up and asset checks.
#
Dependencies
- Active Directory module (Microsoft Docs)
#
Function
- Prompts for and selects the correct CSV file from a designated folder.
- Imports the CSV and iterates through each employee record.
- For each employee:
- Checks if the AD account is still active (enabled).
- If active, disables the account and logs details (employee ID, name, manager, etc.) to a dated report file.
- Sets a flag if any accounts were disabled.
- At the end, provides actionable instructions for ICT if any accounts were disabled, including asset and ticket checks.
- Moves the processed CSV to a "Complete" folder and logs the operation.
#
Usage
./Employee-Departure-Reconciliation.ps1
The script is fully interactive and does not require command-line parameters for standard use. It prompts for file selection and guides the user through the process.
#
Inputs
- User selection of CSV file from a folder (interactive prompt)
- CSV file must contain at least a
detnumber
column (employee ID)
#
Variables
$directory
: Folder containing CSV files$csvPath
: Path to the selected CSV file$DestinationFolderReport
: Path to the output report file$infoWrittenToCSV
: Flag indicating if any accounts were disabled
#
Command Line Flags
None for standard use.
#
Outputs
- Disables AD account for the departed employee as needed
- Logs details to a dated CSV report
- Provides actionable instructions for ICT follow-up if required
- Moves processed CSV to a "Complete" folder
#
Notes
- Requires the Active Directory module
- CSV file must be placed in the correct folder and contain the required columns
- Script provides clear error messages and instructions for each step