diff --git a/README.md b/README.md index 25574b6..5683134 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,14 @@ A comprehensive PowerShell script for documenting Microsoft Exchange Server envi ## 🚀 Features ### Supported Environments -- **On-Premises Exchange Server** (2013, 2016, 2019) + +- **On-Premises Exchange Server** (2013, 2016, 2019, SE) - **Exchange Online** (Microsoft 365) - **Hybrid Exchange** environments - **Exchange Online Protection** (EOP) settings ### 🔧 Critical Infrastructure Components + - **SMTP Relay Configuration**: Complete send/receive connector documentation - **Exchange Web Services (EWS)**: Virtual directory configurations and certificates - **Certificate Management**: All Exchange certificates with expiration tracking @@ -21,6 +23,7 @@ A comprehensive PowerShell script for documenting Microsoft Exchange Server envi ### Documentation Coverage #### On-Premises Exchange + - Exchange server inventory and roles - Database configurations (mailbox, public folder) - Database Availability Groups (DAG) @@ -32,7 +35,8 @@ A comprehensive PowerShell script for documenting Microsoft Exchange Server envi - Client access services - Mailbox statistics and distribution -#### Additional On-Premises Components: +#### Additional On-Premises Components + - **Exchange Certificates**: All certificates with expiration dates and services - **SMTP Relay Configuration**: Complete send/receive connector settings - **EWS and Client Access**: All virtual directories with authentication methods @@ -44,6 +48,7 @@ A comprehensive PowerShell script for documenting Microsoft Exchange Server envi - **Management Roles**: Security and administrative role assignments #### Exchange Online + - Organization configuration - Tenant information and accepted domains - Mailbox plans and policies @@ -56,7 +61,8 @@ A comprehensive PowerShell script for documenting Microsoft Exchange Server envi - Retention and quarantine policies - Detailed mailbox and group statistics -#### Additional Exchange Online Components: +#### Additional Exchange Online Components + - **SMTP Relay for Cloud**: Inbound/outbound connectors for hybrid scenarios - **DKIM Configuration**: Domain-based message authentication - **Advanced Threat Protection**: Complete Defender for Office 365 settings @@ -65,11 +71,13 @@ A comprehensive PowerShell script for documenting Microsoft Exchange Server envi - **Audit Configuration**: Admin audit logging and compliance settings ### Output Formats + - **CSV Report**: Machine-readable format for data analysis - **HTML Report**: Interactive, professional report with collapsible sections - **Comprehensive Statistics**: Summary dashboards and detailed breakdowns ## 🚨 Critical Monitoring Features + - **Certificate Expiration Alerts**: Automatic detection of expired and expiring certificates - **Security Configuration Review**: Complete authentication and TLS settings - **SMTP Relay Documentation**: All inbound/outbound connectors with security settings @@ -78,25 +86,30 @@ A comprehensive PowerShell script for documenting Microsoft Exchange Server envi ## 📋 Prerequisites ### PowerShell Modules + The script will automatically check for and optionally install required modules: #### For Exchange Online -\`\`\`powershell + +```powershell Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser -\`\`\` +``` + +#### For Microsoft Graph (Optional - provides additional Entra ID data) -#### For Microsoft Graph (Optional - provides additional Azure AD data) -\`\`\`powershell +```powershell Install-Module -Name Microsoft.Graph -Scope CurrentUser -\`\`\` +``` ### Permissions Required -#### On-Premises Exchange +#### On-Premises Exchange Permissions + - Exchange Organization Management role - Local administrator rights on Exchange server (for PowerShell remoting) -#### Exchange Online +#### Exchange Online Permissions + - Exchange Administrator role - Global Administrator role (for full feature access) - Security Administrator role (for Defender for Office 365 features) @@ -104,90 +117,103 @@ Install-Module -Name Microsoft.Graph -Scope CurrentUser ## 🛠️ Installation 1. **Download the script** - \`\`\`bash - git clone https://github.com/yourusername/exchange-documentation-script.git + + ```bash + git clone https://github.com/MSB365/exchange-documentation-script.git cd exchange-documentation-script - \`\`\` + ``` 2. **Set execution policy** (if needed) - \`\`\`powershell + + ```powershell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - \`\`\` + ``` 3. **Install required modules** (script will prompt if needed) - \`\`\`powershell + + ```powershell Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser Install-Module -Name Microsoft.Graph -Scope CurrentUser - \`\`\` + ``` ## 📖 Usage ### Basic Usage Examples #### Document Exchange Online Only -\`\`\`powershell -.\\Exchange-Documentation-Script.ps1 -Environment Online -OutputPath "C:\\Reports" -\`\`\` + +```powershell +.\Exchange-Documentation-Script.ps1 -Environment Online -OutputPath "C:\Reports" +``` #### Document On-Premises Exchange Only -\`\`\`powershell -.\\Exchange-Documentation-Script.ps1 -Environment OnPremises -ExchangeServer "exchange01.contoso.com" -OutputPath "C:\\Reports" -\`\`\` + +```powershell +.\Exchange-Documentation-Script.ps1 -Environment OnPremises -ExchangeServer "exchange01.contoso.com" -OutputPath "C:\Reports" +``` #### Document Both Environments (Hybrid) -\`\`\`powershell -.\\Exchange-Documentation-Script.ps1 -Environment Both -ExchangeServer "exchange01.contoso.com" -OutputPath "C:\\Reports" -\`\`\` + +```powershell +.\Exchange-Documentation-Script.ps1 -Environment Both -ExchangeServer "exchange01.contoso.com" -OutputPath "C:\Reports" +``` ### Advanced Usage Examples #### Exchange Online with Specific Tenant -\`\`\`powershell -.\\Exchange-Documentation-Script.ps1 -Environment Online -TenantId "contoso.onmicrosoft.com" -OutputPath "C:\\Reports" -\`\`\` + +```powershell +.\Exchange-Documentation-Script.ps1 -Environment Online -TenantId "contoso.onmicrosoft.com" -OutputPath "C:\Reports" +``` #### Certificate-Based Authentication (Exchange Online) -\`\`\`powershell -.\\Exchange-Documentation-Script.ps1 -Environment Online -AppId "12345678-1234-1234-1234-123456789012" -CertificateThumbprint "ABC123DEF456..." -TenantId "contoso.onmicrosoft.com" -\`\`\` + +```powershell +.\Exchange-Documentation-Script.ps1 -Environment Online -AppId "12345678-1234-1234-1234-123456789012" -CertificateThumbprint "ABC123DEF456..." -TenantId "contoso.onmicrosoft.com" +``` #### On-Premises with Specific Credentials -\`\`\`powershell + +```powershell \$cred = Get-Credential -.\\Exchange-Documentation-Script.ps1 -Environment OnPremises -ExchangeServer "exchange01.contoso.com" -Credential \$cred -\`\`\` +.\Exchange-Documentation-Script.ps1 -Environment OnPremises -ExchangeServer "exchange01.contoso.com" -Credential \$cred +``` #### Comprehensive documentation with detailed statistics -\`\`\`powershell -.\\Exchange-Documentation-Script-Enhanced.ps1 -Environment Both -OutputPath "C:\\Reports" -IncludeDetailedStats -\`\`\` + +```powershell +.\Exchange-Documentation-Script-Enhanced.ps1 -Environment Both -OutputPath "C:\Reports" -IncludeDetailedStats +``` #### Focus on certificate and security analysis -\`\`\`powershell -.\\Exchange-Documentation-Script-Enhanced.ps1 -Environment OnPremises -ExchangeServer "exchange01.contoso.com" -IncludeDetailedStats -\`\`\` + +```powershell +.\Exchange-Documentation-Script-Enhanced.ps1 -Environment OnPremises -ExchangeServer "exchange01.contoso.com" -IncludeDetailedStats +``` ## 📊 Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| -| \`Environment\` | String | Yes | Environment to document: \`OnPremises\`, \`Online\`, or \`Both\` | -| \`OutputPath\` | String | No | Output directory for reports (default: current directory) | -| \`ExchangeServer\` | String | No* | FQDN of Exchange server (*required for OnPremises) | -| \`Credential\` | PSCredential | No | Credentials for authentication | -| \`TenantId\` | String | No | Azure AD Tenant ID for Exchange Online | -| \`AppId\` | String | No | Application ID for certificate-based auth | -| \`CertificateThumbprint\` | String | No | Certificate thumbprint for certificate-based auth | +| `Environment` | String | Yes | Environment to document: `OnPremises`, `Online`, or `Both` | +| `OutputPath` | String | No | Output directory for reports (default: current directory) | +| `ExchangeServer` | String | No* | FQDN of Exchange server (*required for OnPremises) | +| `Credential` | PSCredential | No | Credentials for authentication | +| `TenantId` | String | No | Entra ID Tenant ID for Exchange Online | +| `AppId` | String | No | Application ID for certificate-based auth | +| `CertificateThumbprint` | String | No | Certificate thumbprint for certificate-based auth | ## 📈 Report Outputs ### CSV Report + - Machine-readable format - Each category as separate rows - JSON-encoded data for complex objects - Suitable for data analysis and automation ### HTML Report + - Professional, interactive interface - Collapsible sections for easy navigation - Environment-specific color coding @@ -198,6 +224,7 @@ Install-Module -Name Microsoft.Graph -Scope CurrentUser ### Report Categories #### On-Premises Categories + - Organization Configuration - Exchange Servers - Mailbox Databases @@ -210,6 +237,7 @@ Install-Module -Name Microsoft.Graph -Scope CurrentUser - Mailbox Statistics #### Exchange Online Categories + - Organization Configuration - Tenant Information - Mailbox Plans @@ -224,37 +252,43 @@ Install-Module -Name Microsoft.Graph -Scope CurrentUser ### Common Issues #### Module Installation Errors -\`\`\`powershell + +```powershell # Run as Administrator if needed Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber -\`\`\` +``` #### Connection Issues - Exchange Online -\`\`\`powershell + +```powershell # Clear existing sessions Get-PSSession | Remove-PSSession Disconnect-ExchangeOnline -Confirm:\$false # Reconnect Connect-ExchangeOnline -\`\`\` +``` #### Connection Issues - On-Premises -\`\`\`powershell + +```powershell # Verify WinRM configuration winrm quickconfig # Test connectivity Test-NetConnection -ComputerName "exchange01.contoso.com" -Port 80 -\`\`\` +``` #### Permission Issues + - Ensure proper administrative roles are assigned - For Exchange Online: Global Admin or Exchange Admin - For On-Premises: Organization Management role ### Error Handling + The script includes comprehensive error handling: + - Continues execution if individual data collection fails - Logs warnings for failed operations - Provides detailed error messages @@ -263,17 +297,20 @@ The script includes comprehensive error handling: ## 🔒 Security Considerations ### Authentication Methods + - **Interactive Authentication**: Prompts for credentials - **Certificate-Based Authentication**: For unattended execution - **Credential Objects**: For scripted scenarios ### Data Protection + - Reports may contain sensitive configuration data - Store reports in secure locations - Consider encryption for sensitive environments - Review reports before sharing ### Network Security + - Uses encrypted connections (HTTPS/TLS) - Supports certificate-based authentication - No credentials stored in script @@ -281,19 +318,22 @@ The script includes comprehensive error handling: ## 📅 Scheduling and Automation ### Task Scheduler Example -\`\`\`powershell + +```powershell # Create scheduled task for monthly documentation -\$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-File C:\\Scripts\\Exchange-Documentation-Script.ps1 -Environment Online -OutputPath C:\\Reports" + +\$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-File C:\Scripts\Exchange-Documentation-Script.ps1 -Environment Online -OutputPath C:\Reports" \$trigger = New-ScheduledTaskTrigger -Monthly -At "02:00AM" -DaysOfMonth 1 \$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries Register-ScheduledTask -TaskName "Exchange Documentation" -Action \$action -Trigger \$trigger -Settings \$settings -\`\`\` +``` ### Azure Automation Example -The script can be adapted for Azure Automation runbooks for cloud-based scheduling. +The script can be adapted for Azure Automation runbooks for cloud-based scheduling. ### Development Guidelines + - Follow PowerShell best practices - Include error handling for new features - Update documentation for new parameters @@ -302,6 +342,7 @@ The script can be adapted for Azure Automation runbooks for cloud-based scheduli ## 📝 Changelog ### 🔍 What's New in v3.0 + - **Complete SMTP Relay Documentation**: Both on-premises and cloud connectors - **Exchange Certificate Monitoring**: Expiration tracking and alerts - **EWS Virtual Directory Coverage**: Complete client access documentation @@ -311,6 +352,7 @@ The script can be adapted for Azure Automation runbooks for cloud-based scheduli - **Federation and Hybrid Details**: Organization relationships and sharing policies ### Version 2.0 + - Enhanced Exchange Online support - Added Microsoft Graph integration - Improved HTML report design @@ -319,7 +361,7 @@ The script can be adapted for Azure Automation runbooks for cloud-based scheduli - Added module auto-installation ### Version 1.0 + - Initial release - Basic on-premises and Exchange Online support - CSV and HTML report generation -