# AD-Bulk-DepartedEmployeeReconcillation.ps1

  • Purpose
  • Dependencies
  • Function
  • Usage
  • Inputs
  • Variables
  • Command Line Flags
  • Outputs
  • Notes

# Purpose

Automates the bulk reconciliation of departed employees in Active Directory using a CSV file from HR. Validates if each person is still active, disables accounts as needed, logs actions, and provides clear instructions for IT follow-up and asset checks.

# Dependencies

# Function

  1. Prompts for and selects the correct CSV file from a designated folder.
  2. Imports the CSV and iterates through each employee record.
  3. 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.
  4. At the end, provides actionable instructions for IT if any accounts were disabled, including asset and ticket checks.
  5. Moves the processed CSV to a "Complete" folder and logs the operation.

# Usage

./AD-Bulk-DepartedEmployeeReconcillation.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 accounts for departed employees as needed
  • Logs details to a dated CSV report
  • Provides actionable instructions for IT 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