#
Employee-Listing.ps1
Purpose Dependencies Function Usage Inputs Variables Command Line Flags Outputs Notes
#
Purpose
Automates the process of updating Employee IDs and Manager relationships in Active Directory using a CSV file from People Services. Handles error reporting, file selection, and provides actionable feedback for any issues encountered.
#
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:
- Updates the EmployeeID attribute in AD if the user is found.
- Logs users not found to a dated report file.
- Iterates through the CSV again to update Manager relationships for each employee.
- Logs any issues with updating managers to the report file.
- Moves the processed CSV to a "Complete" folder and provides user feedback.
#
Usage
./Employee-Listing.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
detnumber
(Employee ID) anddetcurman
(Manager Employee ID) columns
#
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 issues were logged
#
Command Line Flags
None for standard use.
#
Outputs
- Updates EmployeeID and Manager fields in AD
- Logs users not found or manager update failures to a dated CSV report
- Moves processed CSV to a "Complete" folder
- Provides actionable feedback to the user
#
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