Event ID 7031 and 7034: A service terminated unexpectedly
Most likely cause: A bug in the program behind the service, or in a plug-in it loads (for print spooler crashes, very often a printer driver)
Try first: Note which service and how often (Get-Service -DisplayName 'Print Spooler' | Format-List Name, DisplayName, Status, StartType)
Likely causes
- A bug in the program behind the service, or in a plug-in it loads (for print spooler crashes, very often a printer driver)most likely
- Outdated or partly uninstalled third-party software (antivirus, backup agents, OEM utilities, VPN clients)possible
- Corrupted Windows system files, for built-in servicespossible
- The service was killed by another program, or ran out of memoryless likely
Why this happens
The Service Control Manager starts, stops and watches Windows services. When a service's process exits without telling it, it logs that the service terminated unexpectedly and counts how many times. If the service has recovery actions configured, it logs 7031 and runs the action (restart the service, run a program or restart the computer). If none are configured, it logs 7034. If the recovery action itself fails, it logs 7032.
The SCM only sees the process disappear, so it can't say why. Windows Error Reporting records the actual crash as Event 1000 in the Application log, with the exception code and the faulting module, and that is where the real cause is.
Related service events
- 7023: the service terminated with an error, and the error is named in the event.
- 7024: the service terminated with a service-specific error code.
- 7032: Windows tried the recovery action after a crash and that failed too.
- 7000 / 7009: the service didn't start at all, or didn't start in time; see Event ID 7000 and 7009.
How to fix it
Note which service and how oftenSafe
The event names the service by its display name and says how many times it has crashed. Find its short service name and current state. Replace the display name with the one in your event.
Get-Service -DisplayName 'Print Spooler' | Format-List Name, DisplayName, Status, StartTypeFind the crash in the Application logSafe
At the same minute there is usually an Event 1000 "Application Error" (for svchost-hosted services the faulting application looks like svchost.exe_Spooler) or a .NET Runtime 1026 event. The faulting module name shows what crashed. See Event ID 1000 Application Error for reading it.
Get-WinEvent -FilterHashtable @{LogName='Application'; Id=1000,1026; StartTime=(Get-Date).AddDays(-2)} | Format-List TimeCreated, Id, MessageCheck the recovery settingsSafe
See what Windows does when this service fails. If no actions are set, every crash leaves the service stopped (7034).
sc.exe qfailure SpoolerUpdate, repair or remove the software that owns the serviceChanges settings
For third-party services, install the latest version from the vendor or run its repair option (Settings > Apps > Installed apps). If it belongs to software you no longer use, uninstall it. For Print Spooler crashes, remove printer drivers you don't use and install the current driver from the printer maker; see the print spooler service is not running.
Repair Windows system filesChanges settings
For built-in Windows services, run DISM and then SFC from an administrator terminal and restart.
DISM /Online /Cleanup-Image /RestoreHealth; sfc /scannowSet recovery actions so the service comes backChanges settings
Services > double-click the service > Recovery tab: set First and Second failure to Restart the Service. Or use sc.exe (reset counter after 1 day, restart after 60 seconds). This keeps things running but doesn't fix the crash.
sc.exe failure Spooler reset= 86400 actions= restart/60000/restart/60000/restart/60000
For IT admins
If the Application log doesn't show the cause, capture a crash dump of the service process with WER LocalDumps (HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<process>.exe, DumpType 2 for a full dump) and send it to the vendor. For svchost-hosted Windows services the process is svchost.exe, so scope LocalDumps carefully and remove it afterwards.
Set recovery actions in a GPO or script for business-critical services so a crash restarts them, and alert on 7031/7034 for those services so a crash loop doesn't go unnoticed.
If that didn't fix it
If the service still crashes after updating its software and repairing Windows, collect a crash dump (see For IT admins) and contact the software vendor with it. More event guides: [Windows Event IDs](/windows-event-ids).
When to see a technician
If a security, backup or database service keeps crashing on a business PC or server, get your IT provider to look before you rely on that machine.
Questions people ask
- What is the difference between 7031 and 7034?
- Both mean the service crashed. 7031 says which recovery action Windows will take; 7034 means no recovery action was configured, so the service stays stopped.
- Is one 7031 or 7034 something to worry about?
- One crash, after which the service runs fine, usually isn't. Repeated crashes of the same service are worth fixing, especially for security, backup or print services.
- Why does Print Spooler keep terminating?
- Almost always a bad or outdated printer driver loaded into the spooler. Remove unused printers and drivers and install the current driver from the printer maker.
Sources
- Microsoft Learn: Service Stop Operations (events 7023, 7031, 7032, 7034)
- Microsoft Learn: Event ID 7034, Service Stop Operations
- Microsoft Learn: Application or service crashing behavior troubleshooting guidance
- Microsoft Learn: Collecting user-mode dumps (WER LocalDumps)
- Microsoft Support: Using System File Checker in Windows