-
Notifications
You must be signed in to change notification settings - Fork 0
Get ComprehensiveADReport
Comprehensive Active Directory assessment script designed for AD to AD migration planning. Exports all user accounts, groups, organizational units, and key attributes needed to match users across source and target AD environments.
This script is essential for migration planning, providing complete datasets that enable accurate user matching, group membership migration, and privilege account identification.
- Complete User Export - All user attributes including identifiers, organizational info, contact details, and account status
- User Matching Attributes - Exports EmployeeID, email, UPN, and samAccountName for cross-environment matching
- Group Analysis - All security and distribution groups with member counts and nested group analysis
- Group Memberships - Complete user-to-group mapping for migration planning
- OU Structure - Organizational unit hierarchy with user/computer distribution
- Privileged Accounts - Identifies users in administrative groups requiring special handling
-
Computer Objects - Optional computer inventory with OS details (use
-IncludeComputersswitch) - Migration Recommendations - Analyzes data quality and suggests matching strategies
- Executive Summary - Text report with statistics, analysis, and next steps
- PowerShell: 5.1 or later
-
Required Modules:
- ActiveDirectory (RSAT Tools or Domain Controller)
-
Permissions:
- Domain user with read access to Active Directory
- For comprehensive data, Domain Admin or equivalent recommended
-
Environment:
- Run on Domain Controller or workstation with RSAT installed
- Network connectivity to domain controllers
None - script uses sensible defaults and can run without parameters.
-
OutputDirectory: Directory for assessment reports
- Default:
C:\Reports\AD_Assessment - Automatically created if doesn't exist
- Example:
-OutputDirectory "C:\Migration\SourceAD"
- Default:
-
Domain: Target domain FQDN to query
- Overrides default domain context
- Essential for querying different domains or forests
- Example:
-Domain "sachicis.org" - Note: All AD queries will target this domain explicitly
-
DomainController: Specific domain controller to query
- If not specified, uses default DC
- Can be combined with
-Domainparameter - Example:
-DomainController "DC01.contoso.com"
-
Credential: Credentials for cross-forest/domain authentication
- Use when querying different forest requiring separate authentication
- PSCredential object (prompt with Get-Credential)
- Example:
-Credential (Get-Credential) - Commonly used with
-Domainfor cross-forest scenarios
-
IncludeDisabledUsers: Include disabled user accounts in export
- Default: Exports enabled users only
- Example:
-IncludeDisabledUsers
-
IncludeComputers: Include computer objects in assessment
- Exports computer inventory with OS details
- Example:
-IncludeComputers
-
IncludeGroupDetails: Include detailed group analysis
- Analyzes nested group memberships
- Example:
-IncludeGroupDetails
-
SearchBase: Limit assessment to specific OU
- Restricts scope to DN provided
- Example:
-SearchBase "OU=Corporate,DC=contoso,DC=com"
-
OrganizationName: Organization name for report headers
- Default: "Organization"
- Example:
-OrganizationName "Contoso"
.\Get-ComprehensiveADReport.ps1Runs assessment with default settings, exports enabled users and groups to C:\Reports\AD_Assessment.
.\Get-ComprehensiveADReport.ps1 -OutputDirectory "C:\Migration\SourceAD" -IncludeDisabledUsers -IncludeComputersFull assessment including disabled users and computers, saves to custom directory for migration planning.
.\Get-ComprehensiveADReport.ps1 -SearchBase "OU=Corporate,DC=contoso,DC=com" -OrganizationName "Contoso"Limits assessment to Corporate OU only, sets organization name for reports.
.\Get-ComprehensiveADReport.ps1 -DomainController "DC01.contoso.com" -IncludeGroupDetailsQueries specific domain controller with detailed nested group analysis.
.\Get-ComprehensiveADReport.ps1 -OutputDirectory "C:\ADMigration\Source" -IncludeDisabledUsers -IncludeComputers -OrganizationName "SourceOrg"Complete source AD assessment for migration, includes all users, computers, and custom organization name.
.\Get-ComprehensiveADReport.ps1 -OutputDirectory "C:\ADMigration\Target" -OrganizationName "TargetOrg"Target AD assessment to compare with source data for migration validation.
.\Get-ComprehensiveADReport.ps1 -Domain "sachicis.org" -OrganizationName "SACHICIS"Query a specific domain by FQDN, useful when assessing multiple domains from single workstation.
$Cred = Get-Credential
.\Get-ComprehensiveADReport.ps1 -Domain "partnerdomain.com" -Credential $Cred -OutputDirectory "C:\Migration\PartnerAD"Assess AD in different forest requiring separate credentials. Prompts for credentials, then queries target domain.
Default: C:\Reports\AD_Assessment (or specify with -OutputDirectory)
-
AD_Users_Full_{timestamp}.csv
- Complete user export with 50+ attributes
- Key columns for matching: SamAccountName, UserPrincipalName, EmailAddress, EmployeeID
- Account status: Enabled, LockedOut, PasswordExpired, LastLogonDate
- Organizational: Department, Title, Company, Manager
- Contact: TelephoneNumber, Mobile, Address fields
- Group memberships: Semi-colon delimited list
-
AD_Groups_Summary_{timestamp}.csv
- All security and distribution groups
- Columns: Name, GroupCategory, GroupScope, MemberCount, Description
- Member breakdown: UserMembers, GroupMembers, ComputerMembers
-
AD_GroupMemberships_{timestamp}.csv
- User-to-group mapping table
- Columns: UserSamAccountName, UserUPN, GroupSamAccountName, GroupName
- Essential for replicating group memberships in target AD
-
AD_OUs_Structure_{timestamp}.csv
- Organizational unit hierarchy
- Columns: Name, DistinguishedName, UserCount, ComputerCount, GroupCount
- Use for planning target OU structure
-
AD_Computers_{timestamp}.csv (if
-IncludeComputersused)- Computer inventory
- Columns: Name, DNSHostName, OperatingSystem, IPv4Address, Enabled, LastLogonDate
- OS breakdown for planning
-
AD_PrivilegedAccounts_{timestamp}.csv
- Users in administrative groups
- Groups monitored: Domain Admins, Enterprise Admins, Schema Admins, etc.
- Columns: UserSamAccountName, UserName, PrivilegedGroup
- CRITICAL: Review for special migration handling
-
AD_Assessment_Report_{timestamp}.txt
- Executive summary with statistics
- Domain information and functional levels
- User/group/OU counts and analysis
- Migration recommendations based on data quality
- Suggested matching strategies
- Next steps for migration
Pattern: {Category}_{Type}_{YYYYMMDD_HHmmss}.{ext}
Example: AD_Users_Full_20260107_143052.csv
- EmployeeID - Most reliable if consistently populated in both environments
- EmailAddress - Good fallback if EmployeeID not used
- UserPrincipalName - Can work if UPN format consistent
- SamAccountName - Last resort, may require manual validation
-
Run script in SOURCE AD environment
-
Run script in TARGET AD environment
-
Load both
AD_Users_Full_*.csvfiles into Excel or PowerShell -
Compare using chosen matching attribute:
$SourceUsers = Import-Csv "C:\Migration\Source\AD_Users_Full_20260107_143052.csv" $TargetUsers = Import-Csv "C:\Migration\Target\AD_Users_Full_20260107_150023.csv" # Match by EmployeeID $Matches = foreach ($SUser in $SourceUsers) { $TUser = $TargetUsers | Where-Object { $_.EmployeeID -eq $SUser.EmployeeID -and ![string]::IsNullOrWhiteSpace($_.EmployeeID) } if ($TUser) { [PSCustomObject]@{ SourceSamAccountName = $SUser.SamAccountName TargetSamAccountName = $TUser.SamAccountName MatchedOn = "EmployeeID" EmployeeID = $SUser.EmployeeID SourceUPN = $SUser.UserPrincipalName TargetUPN = $TUser.UserPrincipalName } } }
-
Review non-matching users for manual mapping
-
Use
AD_GroupMemberships_*.csvto plan group migration -
Use
AD_PrivilegedAccounts_*.csvto identify admin accounts needing special handling
The script analyzes your data and provides recommendations:
- If <80% of users have EmployeeID, consider using Email as primary match
- Review privileged accounts CSV before migration
- Validate OU structure mapping between environments
Symptoms: "ActiveDirectory module not found" error
Solution: Install RSAT tools
# Windows 10/11
Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0
# Windows Server
Install-WindowsFeature RSAT-AD-PowerShellSymptoms: Permission errors when querying AD objects
Solution:
- Ensure you're logged in with domain credentials
- For full assessment, use Domain Admin or equivalent
- For read-only assessment, Domain User is sufficient
- Use
-DomainControllerto target specific DC if permissions vary
Symptoms: Script runs slowly with 10,000+ users
Solution:
- Use
-SearchBaseto limit scope to specific OUs - Run during off-peak hours
- Target specific DC with
-DomainControllerif some DCs are faster - Consider breaking into multiple runs per OU
Symptoms: User matching difficult due to missing key attributes
Solution:
- Review the assessment report's "Matching Attribute Coverage" section
- If EmployeeID coverage low, use Email as primary match
- If both low, consider populating missing attributes before migration
- Use SamAccountName or DisplayName as last resort with manual validation
Symptoms: Group membership export phase slow with many groups
Solution:
- This is normal for large environments with complex group nesting
- Script processes each user's group memberships individually
- Consider using
-IncludeGroupDetailsonly when needed for nested analysis - Results are worth the wait for migration planning
Symptoms: Script returns data from current domain instead of specified domain
Solution:
- Use
-Domainparameter with full FQDN:-Domain "targetdomain.com" - Script explicitly passes domain to ALL AD cmdlets internally
- Verify with console output: "Connected to domain: targetdomain.com"
- For cross-forest scenarios, combine with
-Credentialparameter - Ensure network connectivity to target domain controllers
Symptoms: Some admin accounts not appearing in privileged accounts CSV
Solution:
- Script checks standard admin groups (Domain Admins, Enterprise Admins, etc.)
- Custom privileged groups may need manual review
- Review the full group memberships CSV for custom admin groups
- Consider adding custom group names to the script if needed repeatedly
-
Run Assessment in Source AD - Export all data with
-IncludeDisabledUsersand-IncludeComputers - Run Assessment in Target AD - Compare structure and identify gaps
- Analyze Matching Quality - Review EmployeeID and Email coverage percentages
- Document Custom Strategy - Define how to handle non-matching users
- Review Privileged Accounts - Plan manual migration for admin accounts
-
Map OU Structures - Use
AD_OUs_Structure_*.csvto plan target OU creation -
Plan Group Recreation - Use
AD_Groups_Summary_*.csvto recreate groups in target - Identify Dependencies - Review group memberships for nested groups
- Test with Pilot - Migrate subset of users first to validate matching
- Run Assessment in Target AD - After migration, export updated target state
- Compare Counts - Validate user/group counts match expected
- Verify Memberships - Compare group memberships before and after
- Audit Privileged Access - Ensure admin accounts migrated correctly
- Start-FileShareAssessment - Assess file shares for migration
- Export-ADLyncTeamsMigrationData (Lync folder) - Export AD data with Lync attributes for Teams migration
- Check-PrivilegeRolestoPIM (Security folder) - Analyze privileged roles for PIM conversion
-
v1.0 (2026-01-07): Initial release
- Complete user, group, OU, and computer export
- Privileged account identification
- Migration recommendations
- User matching attribute analysis
- Executive summary reporting
- Cross-domain querying with -Domain parameter
- Cross-forest authentication with -Credential parameter
- RSAT auto-install capability
- Overview
- Start-LyncCsvExporter
- Get-ComprehensiveLyncReport
- Get-LyncHealthReport
- Get-LyncInfrastructureReport
- Get-LyncServiceStatus
- Get-LyncUserRegistrationReport
- Export-ADLyncTeamsMigrationData
- New-Office365Accounts
- Sync-ContactsFromCsv
- Set-EmailToSharedAccount
- Set-SMTPForward
- Invoke-UserSignOutAndBlock
- Security Assessment Scripts (coming soon)
- Azure Automation (documentation pending)
- Get-GraphToken
- Get-GraphHeaders
- Get-AzureResourcePaging
- Get-EnterpriseAppUsage
- Get-ExchangeErrorsGraph
- Get-PBIWorkspaceUsageReport
- Intune Management (documentation pending)