-
Notifications
You must be signed in to change notification settings - Fork 0
Get LyncHealthReport
Generates a comprehensive health and diagnostics report for Lync/Skype for Business environments. This monitoring tool performs deep health checks including certificate validation, database mirror states, health monitoring configuration, event log analysis, and system performance metrics.
- Certificate Status Monitoring: Expiration tracking and validity checks
- Database Mirror State Analysis: SQL mirroring health and synchronization
- Health Monitoring Config: Validates monitoring configuration
- Event Log Analysis: Recent error and warning detection
- Performance Metrics: System resource utilization
- Lync-Specific Counters: Service performance indicators (when available)
- Customizable Timeframes: Configurable event log and analysis periods
- Detailed Diagnostics: Root cause analysis assistance
- PowerShell Version: 3.0 or higher
- Required Environment: Lync/Skype for Business Management Shell
-
Required Permissions:
- Lync Administrator or CsAdministrator role
- Local Administrator (for event log access)
- SQL read permissions (for database mirror state)
- Network Requirements: Access to Front End servers and SQL databases
-
PoolFQDN: Primary Lync pool FQDN
- Type: String
- Validation: Must not be null or empty
- Description: FQDN of the Lync pool to analyze for health checks
- Example:
"lyncpool.contoso.com"
-
ReportPath: Output file path
- Type: String
- Default:
"C:\Reports\Lync_Health_Diagnostics_{timestamp}.txt" - Description: Full path where health report will be saved
-
EventLogHours: Event log analysis period
- Type: Integer
- Default:
24 - Range: 1 to 168 hours (1 week)
- Description: Hours to look back when analyzing event logs
-
MaxEventLogErrors: Maximum errors to retrieve
- Type: Integer
- Default:
20 - Description: Limits the number of event log errors analyzed
-
OrganizationName: Organization name
- Type: String
- Default:
"Organization" - Description: Organization name for report headers
.\Get-LyncHealthReport.ps1 -PoolFQDN "lyncpool.contoso.com"Generates a health report with default 24-hour event log analysis.
.\Get-LyncHealthReport.ps1 -PoolFQDN "lyncpool.contoso.com" -OrganizationName "Contoso Corp" -EventLogHours 48Analyzes 48 hours of event logs with custom organization name.
.\Get-LyncHealthReport.ps1 -PoolFQDN "lyncpool.contoso.com" -ReportPath "D:\Reports\Health_Report.txt" -MaxEventLogErrors 50Increases error log capture to 50 entries for detailed troubleshooting.
.\Get-LyncHealthReport.ps1 -PoolFQDN "lyncpool.contoso.com" -EventLogHours 168 -MaxEventLogErrors 100Full week analysis with extended error logging for weekly health reviews.
For each certificate in the Lync certificate store:
- Thumbprint: Unique certificate identifier
- Subject: Certificate subject name and purpose
- Issuer: Certificate authority information
- Expiration Date: When certificate expires
- Days Until Expiration: Countdown with status indicators
-
Status:
- π΄ CRITICAL (< 30 days): Immediate renewal required
β οΈ WARNING (30-90 days): Plan renewal soon- β OK (> 90 days): Certificate healthy
For the specified pool:
- Database Identity: Primary database name and location
-
State Machine State: Current mirroring state
- Synchronized: Healthy replication
- Principal: Active database
- Mirror: Standby database
- Disconnected: Mirroring failure
- Synchronized Status: True/False replication status
- Failover Readiness: Assessment of DR capability
- Monitoring Configuration Status: Enabled/Disabled
- Active Monitoring Rules: Count and listing
- Health Check Intervals: Configured check frequencies
- Alert Thresholds: Warning and critical thresholds
- Monitoring Gaps: Uncovered services or components
From Application, System, and Lync-specific event logs:
- Time Written: When error occurred
- Source: Application or service generating error
- Event ID: Numeric event identifier
- Level: Error, Warning, Critical
- Message: Full error message text
- User Context: Account running when error occurred (if available)
Event Sources Analyzed:
- Lync Server services (RTC*)
- SQL Server (for database errors)
- Windows System events
- Application events
- CPU Utilization: Current and average CPU usage
- Memory Usage: Total, used, and available memory
- Disk Space: Free space on system and data drives
- Network Utilization: Bandwidth usage (if available)
- Process Count: Active Lync-related processes
- Handle Count: System handle utilization
- Active Conferences: Current conference count
- Active Users: Currently signed-in users
- Failed Logins: Authentication failures
- Media Quality: Audio/video quality metrics
- SIP Messages: Message throughput
- Database Latency: SQL query performance
Default: C:\Reports\
Pattern: Lync_Health_Diagnostics_{YYYYMMDD_HHmmss}.txt
Example: Lync_Health_Diagnostics_20251223_143052.txt
Real-time progress indicators during health checks:
- Certificate scanning progress
- Database connectivity status
- Event log analysis progress
- Performance counter collection status
Solution: Run as Administrator:
# Right-click PowerShell/Lync Management Shell
# Select "Run as Administrator"
.\Get-LyncHealthReport.ps1 -PoolFQDN "lyncpool.contoso.com"Or grant event log read permissions:
# Grant specific user event log read access
wevtutil sl Application /ca:O:BAG:SYD:(A;;0x1;;;BA)(A;;0x1;;;DOMAIN\Username)Possible Causes:
- Pool doesn't use SQL mirroring
- Incorrect PoolFQDN specified
- SQL permissions insufficient
Solution: Verify mirroring configuration:
# Check if mirroring is configured
Get-CsDatabaseMirrorState -PoolFqdn "lyncpool.contoso.com"
# If null, mirroring may not be configured
Get-CsPool -Identity "lyncpool.contoso.com" | Select-Object MirrorServerSolution: This is expected if:
- Performance counters not installed
- Lync services not running
- Remote server querying (counters are local only)
The script continues with system performance metrics only.
Solution: This could indicate:
- Good news: System is healthy (no errors)
- Event logs cleared recently
- Insufficient permissions
Verify event logs exist:
Get-EventLog -LogName Application -Newest 10 -EntryType ErrorError: "Cannot access certificate store"
Solution: Ensure running as Administrator and certificate store is accessible:
# Verify certificate access
Get-ChildItem Cert:\LocalMachine\My
# If fails, repair certificate store permissions
certutil -repairstore mySolution: Large event logs can slow processing:
- Reduce
-EventLogHoursparameter (use 24 instead of 168) - Reduce
-MaxEventLogErrorsparameter (use 20 instead of 100) - Run on the Front End server directly (faster event log access)
Solution: Verify pool name:
# List all pools
Get-CsPool | Select-Object Identity, Fqdn
# Use exact FQDN from output
.\Get-LyncHealthReport.ps1 -PoolFQDN "correct-pool-fqdn.contoso.com"Schedule daily health checks:
# Create scheduled task to run daily
$Action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-File `"C:\Scripts\Get-LyncHealthReport.ps1`" -PoolFQDN `"lyncpool.contoso.com`""
$Trigger = New-ScheduledTaskTrigger -Daily -At 6:00AM
Register-ScheduledTask -TaskName "Lync Daily Health Check" -Action $Action -Trigger $TriggerDuring outages or issues:
- Generate immediate health report
- Review event log section for recent errors
- Check certificate status for expiration issues
- Verify database mirror state
- Identify resource bottlenecks in performance section
Weekly health reviews:
# Every Monday, analyze full week
.\Get-LyncHealthReport.ps1 -PoolFQDN "lyncpool.contoso.com" -EventLogHours 168 -MaxEventLogErrors 50Review for:
- Trend analysis in error patterns
- Certificate approaching expiration
- Database mirror interruptions
- Performance degradation
Monthly certificate audits:
- Run health report
- Extract certificate section
- Create renewal timeline
- Coordinate with PKI team
Before and after changes:
# Before change
.\Get-LyncHealthReport.ps1 -PoolFQDN "pool.contoso.com" -ReportPath "C:\Reports\Pre-Change-Health.txt"
# Perform change
# After change
.\Get-LyncHealthReport.ps1 -PoolFQDN "pool.contoso.com" -ReportPath "C:\Reports\Post-Change-Health.txt"
# Compare reports
Compare-Object (Get-Content "C:\Reports\Pre-Change-Health.txt") (Get-Content "C:\Reports\Post-Change-Health.txt")Establish performance baselines:
- Generate health reports during normal operations
- Document typical CPU, memory, and counter values
- Use baselines to identify performance degradation
- Capacity planning and growth trending
- Certificates expiring within 30 days
- Database mirror disconnected or not synchronized
- Critical event log errors from Lync services
- CPU consistently above 90%
- Memory exhaustion
- Disk space below 10%
- Certificates expiring 30-90 days
- Intermittent database synchronization issues
- Event log warnings from Lync services
- CPU consistently above 70%
- Memory usage above 80%
- Disk space below 20%
- Certificates expiring 90+ days out
- Normal event log entries
- Resource utilization within normal ranges
- All services running properly
- Get-ComprehensiveLyncReport.ps1 - Complete environment assessment
- Get-LyncServiceStatus.ps1 - Detailed service status
- Get-LyncInfrastructureReport.ps1 - Infrastructure configuration
-
v2.0 (2025-09-17): Enhanced health diagnostics
- Added event log analysis
- Enhanced performance metrics
- Improved certificate checking
- Added health monitoring configuration
- Better error handling
-
v1.0 (2024): Initial release
- Basic health checking
- Certificate monitoring
- 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)