Medha Cloud
Medha Cloud Exchange Server Team
Exchange Database Recovery Team8 min read

Event IDs 7031 and 7032 indicate that an Exchange service terminated unexpectedly and Windows took recovery action. This guide helps you identify the crashing service, find the root cause, and implement fixes to prevent recurring crashes.

Our Exchange Stability Team specializes in diagnosing and resolving service crash issues.

Error Overview: Service Recovery Events

Windows Service Control Manager (SCM) monitors services and can automatically restart them when they crash. Event 7031 logs the crash, and 7032 logs the recovery action taken.

Typical Event Log Entries
# Event ID 7031 - Service Terminated
Log Name:      System
Source:        Service Control Manager
Event ID:      7031
Level:         Error
Description:   The Microsoft Exchange RPC Client Access service
               terminated unexpectedly. It has done this 1 time(s).
               The following corrective action will be taken in
               5000 milliseconds: Restart the service.

# Event ID 7032 - Recovery Action Taken
Log Name:      System
Source:        Service Control Manager
Event ID:      7032
Level:         Information
Description:   The Service Control Manager tried to take a
               corrective action (Restart the service) after the
               unexpected termination of the Microsoft Exchange
               RPC Client Access service.

Symptoms & Business Impact

What Users Experience:

  • Outlook disconnects briefly then reconnects
  • Repeated "Trying to connect" or "Disconnected" status
  • MAPI errors when accessing mailbox features
  • Calendar and free/busy lookups timeout

What Admins See:

  • Event IDs 7031/7032 in System log
  • Service restart patterns in event log
  • Possible Watson crash dumps
  • Performance degradation during crash cycles
Check Recent Service Crashes
# Find recent service termination events
Get-WinEvent -FilterHashtable @{
    LogName = 'System'
    Id = 7031,7032
    StartTime = (Get-Date).AddDays(-7)
} | Select-Object TimeCreated, Id, Message | Format-Table -Wrap

# Count crashes by service
Get-WinEvent -FilterHashtable @{
    LogName = 'System'
    Id = 7031
    StartTime = (Get-Date).AddDays(-7)
} | Group-Object { ($_.Message -split "'")[1] } |
    Select-Object Count, Name | Sort-Object Count -Descending

Common Causes

1. Memory Exhaustion (35%)

Exchange services consume excessive memory due to large mailboxes, many connections, or memory leaks, leading to out-of-memory crashes.

2. Database Connectivity Issues (25%)

RPC service crashes when it cannot communicate with the mailbox database, often due to disk I/O issues, database corruption, or storage failures.

3. Software Bugs (20%)

Known issues in specific Exchange versions that require Cumulative Updates or hotfixes to resolve.

4. Antivirus Interference (15%)

Real-time scanning of Exchange processes or databases causes timeouts and service crashes.

5. Hardware/Driver Issues (5%)

Failing storage, network drivers, or hardware causing intermittent failures that crash Exchange services.

Quick Diagnosis

Step 1: Identify the Crashing Service
# Get details of recent crashes
Get-WinEvent -FilterHashtable @{
    LogName = 'System'
    Id = 7031
    StartTime = (Get-Date).AddDays(-1)
} | ForEach-Object {
    $serviceName = ($_.Message -split "'")[1]
    [PSCustomObject]@{
        Time = $_.TimeCreated
        Service = $serviceName
        Message = $_.Message.Substring(0, [Math]::Min(100, $_.Message.Length))
    }
} | Format-Table -Wrap
Step 2: Find Related Application Errors
# Look for errors just before the crash
$crashTime = (Get-WinEvent -FilterHashtable @{
    LogName = 'System'
    Id = 7031
} -MaxEvents 1).TimeCreated

Get-WinEvent -FilterHashtable @{
    LogName = 'Application'
    Level = 2  # Error
    StartTime = $crashTime.AddMinutes(-5)
    EndTime = $crashTime
} | Select-Object TimeCreated, ProviderName, Id, Message | Format-Table -Wrap
Step 3: Check Service Status and Recovery Settings
# Check current service status
Get-Service MSExchange* | Where-Object { $_.Status -ne 'Running' } |
    Select-Object Name, Status, StartType | Format-Table

# Check service recovery settings using sc.exe
$services = @("MSExchangeRPC", "MSExchangeIS", "MSExchangeServiceHost")
foreach ($svc in $services) {
    Write-Host "=== $svc ===" -ForegroundColor Cyan
    sc.exe qfailure $svc
}

Quick Fix (Immediate Stability)

Restart Affected Services
# Restart the crashing service(s)
$crashingService = "MSExchangeRPC"  # Replace with actual service name

Write-Host "Stopping $crashingService..."
Stop-Service $crashingService -Force
Start-Sleep -Seconds 10

Write-Host "Starting $crashingService..."
Start-Service $crashingService
Start-Sleep -Seconds 5

# Verify service is running
$status = Get-Service $crashingService
Write-Host "$crashingService is now: $($status.Status)"$status.Status)"

Detailed Solutions

Solution 1: Configure Service Recovery

Set Proper Recovery Options
# Configure service to restart on failure with delays
$services = @("MSExchangeRPC", "MSExchangeIS", "MSExchangeServiceHost")

foreach ($svc in $services) {
    # Set recovery: restart after 1min, 2min, 5min
    sc.exe failure $svc reset=86400 actions=restart/60000/restart/120000/restart/300000
    Write-Host "Configured recovery for $svc"
}

# Verify settings
foreach ($svc in $services) {
    Write-Host "=== $svc ===" -ForegroundColor Cyan
    sc.exe qfailure $svc
}

Solution 2: Address Memory Issues

Check and Address Memory Pressure
# Check Exchange process memory usage
Get-Process -Name "Microsoft.Exchange.*", "w3wp", "EdgeTransport" -ErrorAction SilentlyContinue |
    Select-Object ProcessName, Id, @{N='MemoryMB';E={[math]::Round($_.WorkingSet64/1MB)}} |
    Sort-Object MemoryMB -Descending | Format-Table -AutoSize

# Check system memory
$os = Get-WmiObject Win32_OperatingSystem
$freeMemGB = [math]::Round($os.FreePhysicalMemory/1MB,2)
$totalMemGB = [math]::Round($os.TotalVisibleMemorySize/1MB,2)
$usedPercent = [math]::Round((1 - $os.FreePhysicalMemory/$os.TotalVisibleMemorySize) * 100)
Write-Host "Memory: $freeMemGB GB free of $totalMemGB GB ($usedPercent% used)"$totalMemGB GB ($usedPercent% used)"

# If memory is critically low, consider:
# 1. Restarting high-memory services-memory services
# 2. Adding RAM to server
# 3. Reducing concurrent connections

Solution 3: Check for Known Issues and Updates

Verify Exchange Version and Updates
# Check current Exchange version
Get-ExchangeServer | Select-Object Name, AdminDisplayVersion | Format-Table

# Check if latest CU is installed
$version = (Get-ExchangeServer).AdminDisplayVersion
Write-Host "Current version: $version"
Write-Host ""
Write-Host "Check for latest CU at:"
Write-Host "https://docs.microsoft.com/en-us/exchange/new-features/build-numbers-and-release-dates"-features/build-numbers-and-release-dates"

# Check Windows Updates
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 10 |
    Select-Object HotFixID, Description, InstalledOn | Format-Table

Solution 4: Antivirus Exclusions

Verify Antivirus Exclusions
# Paths that should be excluded from AV scanning
$exclusions = @(
    "$env:ExchangeInstallPath" + "Bin",
    "$env:ExchangeInstallPath" + "Mailbox",
    "$env:ExchangeInstallPath" + "TransportRoles",
    "$env:ExchangeInstallPath" + "Logging",
    "$env:ExchangeInstallPath" + "ClientAccess"
)

Write-Host "Ensure these paths are excluded from antivirus:" -ForegroundColor Yellow
$exclusions | ForEach-Object { Write-Host "  $_" }

Write-Host ""
Write-Host "Also exclude these processes:" -ForegroundColor Yellow
$processes = @("EdgeTransport.exe", "Microsoft.Exchange.*.exe", "w3wp.exe", "MSExchangeHMWorker.exe")
$processes | ForEach-Object { Write-Host "  $_" }

Write-Host ""
Write-Host "Refer to: https://docs.microsoft.com/en-us/exchange/antispam-and-antimalware/windows-antivirus-software"-and-antimalware/windows-antivirus-software"

Verify the Fix

Monitor Service Stability
# Check for crashes in last hour
$recentCrashes = Get-WinEvent -FilterHashtable @{
    LogName = 'System'
    Id = 7031
    StartTime = (Get-Date).AddHours(-1)
} -ErrorAction SilentlyContinue

if ($recentCrashes) {
    Write-Host "WARNING: $($recentCrashes.Count) crashes in last hour" -ForegroundColor Red
} else {
    Write-Host "OK: No crashes in last hour" -ForegroundColor Green
}

# Verify all services running
Write-Host ""
Write-Host "=== Service Status ===" -ForegroundColor Cyan
Get-Service MSExchange* | Where-Object { $_.Status -ne 'Running' } |
    Select-Object Name, Status | Format-Table

$runningCount = (Get-Service MSExchange* | Where-Object { $_.Status -eq 'Running' }).Count
Write-Host "Running Exchange services: $runningCount"

Prevention Tips

Proactive Monitoring

  • Monitor Event IDs 7031/7032 with alerting
  • Track service restart frequency
  • Monitor memory usage trends
  • Keep Exchange and Windows updated
  • Review crash dumps for patterns

When to Escalate

Contact Exchange specialists if:

  • Service crashes multiple times per day
  • Crashes occur across multiple servers
  • Watson dumps indicate kernel or driver issues
  • Memory usage climbs indefinitely (memory leak)
  • Crashes persist after applying all fixes

Need Expert Help?

Our Exchange Stability Team analyzes crash dumps and implements permanent fixes for recurring service failures.

Frequently Asked Questions

Event ID 7031 indicates a service terminated unexpectedly, while Event ID 7032 indicates the Service Control Manager took a recovery action (like restarting the service). In Exchange, these often relate to MSExchangeRPC or related services crashing.

Still Stuck? We Can Help

Our Exchange Server experts have resolved thousands of issues just like yours.

  • Remote troubleshooting in 95 minutes average
  • No upfront commitment or diagnosis fees
  • Fix-it-right guarantee with documentation
Get Expert Help
95 min
Average Response Time
24/7/365 Availability
Medha Cloud

Medha Cloud Exchange Server Team

Microsoft Exchange Specialists

Our Exchange Server specialists have 15+ years of combined experience managing enterprise email environments. We provide 24/7 support, emergency troubleshooting, and ongoing administration for businesses worldwide.

15+ Years ExperienceMicrosoft Certified99.7% Success Rate24/7 Support