A comprehensive PowerShell module that simulates Active Directory functionality using CSV files as a backend database. This module provides a realistic AD experience for learning, testing, and development purposes.
-
Get-ADUser - Retrieve user information with filtering and property selection
-
New-ADUser - Create new user accounts with comprehensive data
-
Remove-ADUser - Delete user accounts with confirmation
-
Enable-ADAccount - Enable disabled user accounts
-
Disable-ADAccount - Disable active user accounts
-
Learn AD concepts without setting up a domain controller
-
Test AD scripts in a safe, isolated environment
-
Practice PowerShell with realistic AD cmdlets
-
Develop AD automation with full feature support
-
Train teams on AD management without production risks
- CSV Backend - Simple, portable data storage
- Realistic Data - Authentic user information and scenarios
- Data Integrity - Consistent data across all operations
- Backup System - Automatic database backups with timestamped files and ZIP compression
Get-ADUser- Query users with Identity or Filter parametersNew-ADUser- Create new user accounts with validationRemove-ADUser- Delete user accountsEnable-ADAccount- Enable user accountsDisable-ADAccount- Disable user accountsSet-ADAccountPassword- Set user passwords with complexity validation
Get-ADConfig- Read configuration settingsSet-ADConfig- Update configuration settingsTest-ADConfig- Validate configuration integrity
# Clone the repository
git clone https://gitlab.com/ma1c0ntent/CSVActiveDirectory.git
cd CSVActiveDirectory
# One-click installation
.\install.ps1# Clone or download the module
# Navigate to the module directory
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
.\install.ps1Show-ADProgress- Display progress indicatorsStart-ADOperation- Initialize operationsUpdate-ADOperation- Update operation progressComplete-ADOperation- Finalize operationsShow-ADBulkProgress- Bulk operations with error trackingShow-ADStatus- Color-coded status messages
- Custom format files for better output
- Professional table views with proper formatting
- Detailed list views with complete information
- Color-coded status indicators
- Cross-version emoji compatibility (PowerShell 5.1+ and 7+)
Get-UserThreatAnalysis.ps1- Individual user threat analysis with interactive HTML reportsGet-SecurityReport.ps1- Enterprise security reports with enhanced IoC detectionQueries.ps1- Individual security queries for focused analysis- Professional HTML reports with clickable IoC items and collapsible categories
- Color-coded severity levels and actionable recommendations
- Individual user reports stored in
Data/Reports/directory
Cleanup-Backups.ps1- Comprehensive backup management with age-based deletionManage-Backups.ps1- Console menu for enhanced database management to create backups, list backups, cleanup backups, etc.- Automatic backup system with timestamped files and ZIP compression
- Disk space management with safety features and confirmation prompts
# Import the module
Import-Module .\CSVActiveDirectory.psd1 -Force
# Verify installation
Get-Command -Module CSVActiveDirectoryAfter cloning the repository, you must create users to populate the database:
# Option 1: Use the one-click installer (recommended)
.\install.ps1
# Option 2: Create users manually
.\Functions\Private\Create-Users.ps1
# Option 3: Create users with custom settings
.\Functions\Private\Create-Users.ps1 -UserCount 200 -RiskPercentage 25Why is this necessary?
- The repository comes with an empty database for security
- User creation populates the database with realistic test data
- Includes cybersecurity risk scenarios for security analysis
- Enables all module functionality (IoC detection, security reports, etc.)
CSVActiveDirectory/
βββ π Core Files
β βββ CSVActiveDirectory.psd1 # Module manifest
β βββ CSVActiveDirectory.psm1 # Module script
β βββ install.ps1 # One-click installer
β βββ README.md # This file
β βββ CHANGELOG.md # Version history
β βββ LICENSE # License information
β
βββ π Scripts/ # Main script directory
β βββ Create-Users-Menu.ps1 # Interactive user creation menu
β βββ Create-Users.ps1 # User generation with security scenarios (Private)
β βββ Get-UserThreatAnalysis.ps1 # Individual user IoC analysis
β βββ Get-SecurityReport.ps1 # Enterprise security reports
β βββ Queries.ps1 # Security query examples
β βββ Cleanup-Backups.ps1 # Backup management utility
β βββ Test-ModuleFunctions.ps1 # Module function testing
β
βββ π Functions/ # Module functions
β βββ Public/ # Public cmdlets
β β βββ Get-ADUser.ps1
β β βββ New-ADUser.ps1
β β βββ Remove-ADUser.ps1
β β βββ Enable-ADAccount.ps1
β β βββ Disable-ADAccount.ps1
β β βββ Search-ADAccount.ps1
β β βββ Get-ADConfig.ps1
β β βββ Show-ADProgress.ps1
β β βββ Show-ADStatus.ps1
β β βββ Set-ADAccountPassword.ps1
β βββ Private/ # Internal functions
β βββ ConvertTo-ADPasswordHash.ps1
β βββ Get-ADPasswordPolicy.ps1
β βββ Test-ADPassword.ps1
β βββ Test-ADPasswordComplexity.ps1
β
βββ π Data/ # Data storage
β β βββ Database/ # Database files
β β βββ Backups/
β β β βββ DatabaseBackups.zip
β β βββ Database.csv # Current database
β β βββ example-database.csv
β βββ Config/ # Configuration
β β βββ Settings.json
β βββ Formats/ # Display formats
β βββ ADUser.format.ps1xml
β
βββ π Examples/ # Usage examples
β βββ Basic/
β β βββ Demo-BasicFeatures.ps1
β βββ Advanced/
β βββ Demo-EnhancedFeatures.ps1
β βββ Demo-AccountScenarios.ps1
β βββ Demo-DetectionQueries.ps1
β
βββ π Tests/ # Test scripts
β βββ Integration/
β β βββ Module.Tests.ps1
β β βββ User-Lifecycle.Tests.ps1
β βββ Functions/
β βββ Configuration-Management.Tests.ps1
β βββ Enable-Disable-ADAccount.Tests.ps1
β βββ Get-ADUser.Tests.ps1
β βββ New-ADUser.Tests.ps1
β βββ Remove-ADUser.Tests.ps1
β βββ Search-ADAccount.Tests.ps1
β βββ Test-ADPasswordComplexity.Tests.ps1
β
βββ π Docs/ # Documentation
βββ Functions/ # Function documentation
βββ Active-Directory-Cybersecurity-Guide.md
βββ CSV-Export-Guide.md
βββ Cybersecurity-Scenarios.md
βββ Enhanced-IoC-Detection.md
βββ IoC-Analysis-Guide.md
βββ SETUP.md
Located in Scripts/Public/ - Interactive scripts with menus for end users:
Create-Users-Menu.ps1- Interactive menu for user database creationGet-UserThreatAnalysis.ps1- Individual user IoC analysis with interactive HTML reportsGet-SecurityReport.ps1- Enterprise security reports with enhanced IoC detectionManage-Backups.ps1- Interactive backup management with menu options
Located in Scripts/Private/ - Internal scripts for system administration:
Create-Users.ps1- Generate test database with cybersecurity scenarios (Advanced)Test-ModuleFunctions.ps1- Test all module functions for compatibilityTest-PasswordComplexity.ps1- Password complexity testing utilityCleanup-Backups.ps1- Advanced backup cleanup with direct parameter control
install.ps1- One-click installation with module setup and database creation
# Create users with default settings (150 users, 30% risk)
.\Functions\Private\Create-Users.ps1
# Or use the one-click installer
.\install.ps1# Get all users
Get-ADUser -Identity "*"
# Get specific user
Get-ADUser -Identity "mbryan"
# Get users with specific properties
Get-ADUser -Identity "mbryan" -Properties "Department", "Title", "Enabled"
# Filter users
Get-ADUser -Filter "Department -eq 'Security'"# Individual user IoC analysis
.\Scripts\Public\Get-UserThreatAnalysis.ps1 -Username "username"
# Generate professional HTML report
.\Scripts\Public\Get-UserThreatAnalysis.ps1 -Username "username" -ExportReport /path/to/export/to
# Enterprise security report with enhanced IoC detection
.\Scripts\Public\Get-SecurityReport.ps1# Create a new user
New-ADUser -SamAccountName "jdoe" -FirstName "John" -LastName "Doe" -EmailAddress "jdoe@company.com" -Department "IT" -Title "Developer"
# Create user with password
New-ADUser -SamAccountName "asmith" -FirstName "Alice" -LastName "Smith" -EmailAddress "asmith@company.com" -Department "HR" -Title "Manager" -Password "SecurePass123!"# Disable an account
Disable-ADAccount -Identity "jdoe"
# Enable an account
Enable-ADAccount -Identity "jdoe"
# Remove a user
Remove-ADUser -Identity "jdoe" -Confirm:$false# Interactive backup management (recommended for end users)
.\Scripts\Public\Manage-Backups.ps1
# Advanced backup cleanup (for administrators)
.\Scripts\Private\Cleanup-Backups.ps1 -DeleteAfterDays 7
# Preview what would be deleted
.\Scripts\Private\Cleanup-Backups.ps1 -DeleteAfterDays 7 -WhatIf
# Delete all backup files (with confirmation)
.\Scripts\Private\Cleanup-Backups.ps1 -DeleteAll
# Delete all backup files (no confirmation)
.\Scripts\Private\Cleanup-Backups.ps1 -DeleteAll -ForceFirstName,LastName,DisplayName,SamAccountName
DistinguishedName,EmailAddress,EmpID,Title,DepartmentGuid,Created,Modified,Enabled,UserPrincipalNameSID,PrimaryGroupID,PasswordLastSet,LastLogon
- PowerShell 5.1: Full compatibility with ASCII emoji alternatives
- PowerShell 7+: Full compatibility with Unicode emoji support
- Automatic Detection: Scripts automatically detect PowerShell version
- Cross-Platform: Works on Windows, Linux, and macOS
| Feature | PowerShell 5.1 | PowerShell 7+ |
|---|---|---|
| Unicode Emojis | ASCII alternatives | Full Unicode support |
| Null Coalescing | Explicit if/else | ?? operator |
| HTML Reports | β | β |
| IoC Detection | β | β |
| Database Operations | β | β |
Comprehensive testing completed with 100% compatibility:
- 35 scripts tested across both PowerShell versions
- PowerShell 5.1: 35/35 scripts pass β
- PowerShell 7+: 35/35 scripts pass β
- Performance: < 30 seconds for IoC analysis of 1000+ users
- HTML Reports: Interactive with clickable IoC items and collapsible sections
See the test files in the Tests/