Helpdesk: "The overnight System log on APP12 has Service Control Manager errors all over it: 'Contoso Sync Agent' 7023 with 'The service did not start due to a logon failure', 'Print Spooler' 7031 three times with 'Restart the service', and 'Reporting Gateway' 7034 four times with nothing after it. Someone wants to set every service's recovery to restart forever, someone else wants to raise ServicesPipeTimeout to five minutes, and the third idea is a nightly reboot. Can we?"
Not yet. 7023, 7031, and 7034 aren't one problem. They are the Service Control Manager (SCM) telling you three different things: a service stopped with an error, a service died and recovery is configured, and a service died and nothing is said about recovery. Microsoft's service stop events list gives the messages as "The %1 service terminated with the following error: %2" (7023), "The %1 service terminated unexpectedly. It has done this %2 time(s). The following corrective action will be taken in %3 milliseconds: %5." (7031), and "The %1 service terminated unexpectedly. It has done this %2 time(s)." (7034). So the useful questions are in the event text itself: which service, which of the three events, what error text or corrective action, how many times, and what is the service's account, path, and recovery configuration right now. Then match the Application log from the same minute, because the SCM only tells you that the process went away, not why.
This post is a read-first order for those three events: capture them, split by event, read the service's configuration, decode the error, look at the crash side, check logon and dependencies, and only then change one link and prove it. It isn't a walkthrough of one vendor's crash. If a 7023 is really a service that cannot log on with a changed password, Active Directory Account Keeps Getting Locked Out covers the stale-credential hunt; if the failures only happen at boot and the machine's domain controller can't be found yet, Netlogon Event ID 5719 covers that boot-timing event. This post decodes the SCM events and hands off.
TL;DR
- Split by event ID first. 7023 carries an error text, 7031 carries a count and a corrective action, 7034 carries a count only (Microsoft's service stop events table; Step 4).
- 7031 and 7034 mean the process went away. Microsoft: "A service is considered failed when it terminates without reporting a status of SERVICE_STOPPED to the service controller." The reason is not in the SCM event; look in the Application log for the same minute and in the service's own log (Steps 4 and 8).
- 7023's error is a Windows error code with a name. 1067 is "The process terminated unexpectedly.", 1068 is "The dependency service or group failed to start.", 1069 is "The service did not start due to a logon failure." Read the text, then the configuration that matches it (Steps 6, 9, and 10).
-
Recovery is set per service and it is a separate setting.
sc failuretakesreset=in seconds andactions=with delays in milliseconds, up to three actions for the first, second, and third failure (Step 7). - A longer timeout fixes one specific thing. Microsoft: the SCM "waits for the time that is specified by the ServicesPipeTimeout entry before logging event 7000 or 7011", and it warns "we recommend that you research this problem to determine whether it is a symptom of another problem." It does nothing for a service that crashes after it starts (Step 11).
- Prove it by service uptime and event count, not by one quiet hour. Match the process start time to the change, then watch the System log for a full business day (Step 13).
Where in the chain did it break?
| Step | What should be true | Typical symptom when it breaks |
|---|---|---|
| 1. Symptom captured | Which server, which service, which event IDs, how many, since when | "Services keep crashing" with no service name, event ID, or time |
| 2. Coverage | Every affected server's System log is read, for a window that covers the first failure | One server read, the repeats were on the other three |
| 3. Fields read | Service name, count, delay, and action are pulled out of each event | The rendered message skimmed and the counts and actions missed |
| 4. Event decoded | 7023, 7024, 7031, 7032, and 7034 are told apart | A 7023 logon failure treated like a crash, a 7034 treated like a recovery that worked |
| 5. Configuration read | Account, binary path, start mode, state, exit code, and process ID are written down | Restarting the service from the console before anyone saw its account or path |
| 6. Error decoded | The 7023 error text is mapped to Microsoft's code name | "Terminated with an error" with no code attached |
| 7. Recovery read | The failure actions, delays, and reset period are known | Assuming a restart is configured, or that a reboot action is not |
| 8. Crash side | The Application log and the service's own log for that minute are read | The process killed, crashing, or exiting and nobody looking at why |
| 9 to 11. The one check | Logon (1069), dependency (1068, 1075), or start timeout (1053) | One fix tried on every code |
| 12. Change | One link changed on the service that needs it | Restart-forever recovery, a global timeout, or a nightly reboot as the fix |
| 13. Proof | The service process stays up and the events stop, for a full business day | Quiet for an hour after a manual start |
Step 1: Capture the symptom (read-only)
Write this down before touching a service. It decides which of the later steps matter.
- Which server and which service (the name in the event text is the display name; the service name can differ).
- Which event IDs and how many of each. 7023, 7031, and 7034 for the same service are one story told three ways; different services are different stories.
- First and last time, in local time, and whether it lines up with a reboot, a patch, a password change, a deployment, or a backup window.
- What the user sees: the feature is gone, the service shows Stopped, or the service shows Running and nobody noticed.
- Whether recovery already ran: a 7031 says a corrective action will be taken, so check whether the service is up now.
Microsoft's Get-WinEvent page documents the FilterHashtable keys used below (LogName, ProviderName, Id, StartTime), which keeps the query on the server instead of in a pipeline.
# Read-only, on or against one server: the SCM events from the last 48 hours, counted by service and event
$since = (Get-Date).AddHours(-48)
Get-WinEvent -FilterHashtable @{
LogName = 'System'
ProviderName = 'Service Control Manager'
Id = 7000,7001,7009,7011,7023,7024,7031,7032,7034
StartTime = $since
} -ErrorAction SilentlyContinue |
Group-Object Id |
Sort-Object Name |
Format-Table Count, Name -AutoSize
Run it once with -MaxEvents removed and read the whole count. A total of 3 over two days and a total of 300 are different problems.
Step 2: Make sure you're seeing all of it (read-only)
The System log is per machine and it wraps. A busy server with a small log can lose the first failure, which is usually the interesting one.
# Read-only: how big is the System log, how full, and how far back does it go?
Get-WinEvent -ListLog System | Format-List LogName, FileSize, MaximumSizeInBytes, RecordCount, IsEnabled
Get-WinEvent -LogName System -MaxEvents 1 -Oldest | Select-Object TimeCreated
If the oldest event is newer than the first failure, say so in your notes and look at the monitoring or SIEM copy of the log. If more than one server runs the same service (a farm, a cluster, a pair), run Step 1 against each; Get-WinEvent -ComputerName is a documented parameter.
# Read-only: the same count against several servers (replace the names)
'APP11','APP12','APP13' | ForEach-Object {
$s = $_
Get-WinEvent -ComputerName $s -FilterHashtable @{ LogName='System'; ProviderName='Service Control Manager'; Id=7023,7031,7034; StartTime=(Get-Date).AddHours(-48) } -ErrorAction SilentlyContinue |
Group-Object Id | ForEach-Object { [pscustomobject]@{ Server=$s; EventId=$_.Name; Count=$_.Count } }
} | Sort-Object Server, EventId | Format-Table -AutoSize
Step 3: Pull the fields out of each event (read-only)
The rendered message is fine for reading one event. For forty, read the event data. A real 7031 from a Microsoft Q&A thread carries param1 to param5 in its event XML: param1 is the service name, param2 the count, param3 the delay in milliseconds, and param5 the action text, which matches the message template's %1, %2, %3, and %5.
# Read-only: last 48 hours of 7023, 7031, and 7034 as rows, one column per parameter
$since = (Get-Date).AddHours(-48)
$rows = Get-WinEvent -FilterHashtable @{
LogName='System'; ProviderName='Service Control Manager'; Id=7023,7031,7034; StartTime=$since
} -ErrorAction SilentlyContinue | ForEach-Object {
$x = [xml]$_.ToXml()
$d = @{}
foreach ($n in $x.Event.EventData.Data) { $d[$n.Name] = $n.'#text' }
[pscustomobject]@{
Time = $_.TimeCreated
EventId = $_.Id
Service = $d['param1']
P2 = $d['param2']
P3 = $d['param3']
P5 = $d['param5']
Message = ($_.Message -split "`n")[0]
}
}
$rows | Sort-Object Time | Format-Table -AutoSize
For a 7023, the second parameter is the error text rather than a count, so read the Message column for that event instead of P2. Keep the output. Everything after this step is "which of these rows".
| Field | Where | What to write down |
|---|---|---|
| Service name | param1 |
The display name, then the real service name in Step 5 |
| Count |
param2 on 7031 and 7034 |
How many times the SCM says it has happened for that service |
| Delay |
param3 on 7031 |
Milliseconds before the corrective action runs |
| Action |
param5 on 7031 |
Restart the service, run a program, restart the computer, or no action |
| Error text | the message on 7023 | The exact sentence, for Step 6 |
| Time | TimeCreated |
The minute to use for the Application log in Step 8 |
Step 4: Decode which event it is (read-only)
Microsoft's service stop events table for Windows Server 2008 lists these messages. Newer builds log the same events; confirm against your own log, which is what Step 3 just did.
| Event ID | Message template (Microsoft) | What it tells you |
|---|---|---|
| 7023 | The %1 service terminated with the following error: %2 | The service stopped and gave an error. Read the error text (Step 6) |
| 7024 | The %1 service terminated with service-specific error %2. | The service returned its own code, so the vendor defines it (Step 6) |
| 7031 | The %1 service terminated unexpectedly. It has done this %2 time(s). The following corrective action will be taken in %3 milliseconds: %5. | The process died, and a corrective action is configured and about to run |
| 7032 | The Service Control Manager tried to take a corrective action (%2) after the unexpected termination of the %3 service, but this action failed with the following error: %4 | The recovery action itself failed (Step 7) |
| 7034 | The %1 service terminated unexpectedly. It has done this %2 time(s). | The process died. No corrective action is named in the message |
Two readings keep this honest. First, 7031 and 7034 are the same fact, a service terminating without reporting SERVICE_STOPPED, with 7031 adding the recovery action. Microsoft's SERVICE_FAILURE_ACTIONS page defines a failed service as one that "terminates without reporting a status of SERVICE_STOPPED to the service controller", and says the structure "Represents the action the service controller should take on each failure of a service." Second, a 7023 is not a crash by definition. It is a service that stopped, or failed to start, with a Windows error attached, and that error can be a logon failure with no process ever having run.
Don't read a 7034 as "no recovery happened, so something is broken with recovery." The message has no field for an action. Read the configuration in Step 7 before drawing that conclusion.
Step 5: Read the service as configured now (read-only)
Before restarting anything, write down what the service is. Win32_Service exposes the account in StartName, the binary in PathName, the start mode, the state, the process ID, and the last exit code; Microsoft's class page describes ExitCode as the "Windows error code that defines errors encountered in starting or stopping the service" and says it is set to 1066 (ERROR_SERVICE_SPECIFIC_ERROR) "when the error is unique to the service", with the value in ServiceSpecificExitCode.
# Read-only: the service as it is now (replace the display name, or use -Filter "Name='Spooler'")
Get-CimInstance Win32_Service -Filter "DisplayName='Print Spooler'" |
Format-List Name, DisplayName, State, StartMode, DelayedAutoStart, StartName, PathName, ProcessId, ExitCode, ServiceSpecificExitCode
# Read-only: every automatic service that is not running right now, with its account
Get-CimInstance Win32_Service -Filter "StartMode='Auto' AND State<>'Running'" |
Sort-Object Name |
Format-Table Name, State, StartName, ExitCode, PathName -AutoSize
Read it for four things:
-
StartName: LocalSystem, a built-in service account, or a named account. A named account points at Step 9. -
PathName: does the binary exist, and is it where the vendor installed it? A moved or removed file gives a start failure rather than a crash loop. -
StateandProcessId: Running with a recent process is recovery that worked; Stopped with anExitCodeis a service still down. -
ExitCode: 0 is a normal stop, 1066 means readServiceSpecificExitCode, anything else goes to the table in Step 6.
Get-Service is fine for quick state, and its -DependentServices and -RequiredServices parameters matter in Step 10, but it doesn't return the account or the path.
Step 6: Decode the 7023 error (read-only)
A 7023 ends with a sentence. The sentence is the text of a Windows system error code, and Microsoft's system error code list gives the names and numbers.
| Code | Name | Microsoft's text | Go to |
|---|---|---|---|
| 1053 (0x41D) | ERROR_SERVICE_REQUEST_TIMEOUT | The service did not respond to the start or control request in a timely fashion. | Step 11 |
| 1058 (0x422) | ERROR_SERVICE_DISABLED | The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. | Step 5, then Step 12 |
| 1066 (0x42A) | ERROR_SERVICE_SPECIFIC_ERROR | The service has returned a service-specific error code. | The vendor's log and ServiceSpecificExitCode (Step 5) |
| 1067 (0x42B) | ERROR_PROCESS_ABORTED | The process terminated unexpectedly. | Step 8 |
| 1068 (0x42C) | ERROR_SERVICE_DEPENDENCY_FAIL | The dependency service or group failed to start. | Step 10 |
| 1069 (0x42D) | ERROR_SERVICE_LOGON_FAILED | The service did not start due to a logon failure. | Step 9 |
| 1075 (0x433) | ERROR_SERVICE_DEPENDENCY_DELETED | The dependency service does not exist or has been marked for deletion. | Step 10 |
If the sentence isn't in this table, search the same Microsoft list for it, or convert the number: the code is also the value the service reported in its exit code.
# Read-only: turn a Windows error number into its message text (replace 1069)
(New-Object System.ComponentModel.Win32Exception 1069).Message
One caution on 1053. The error text says "did not respond to the start or control request", so it isn't only a start problem: a control request is a stop or a pause too. Microsoft's service control handler page says "The control handler must return within 30 seconds, or the SCM returns an error." Read whether the 7023 came at start or at stop before choosing Step 11.
Step 7: Read the recovery configuration (read-only)
Recovery is stored per service. Microsoft's sc failure page defines the pieces: reset= is "the length of the period (in seconds) with no failures after which the failure count should be reset to 0", actions= takes run, restart, or reboot each with a delay in milliseconds, and "You can specify up to three separate actions with the actions= parameter, to be used the first, second, and third times that a service fails." The SERVICE_FAILURE_ACTIONS page adds that dwResetPeriod is "The time after which to reset the failure count to zero if there are no failures, in seconds."
# Read-only: the recovery settings for one service (use the service name, not the display name)
sc.exe qfailure Spooler
Read the output against the events:
| What you see | What it means |
|---|---|
| Three RESTART actions with delays | The first three failures restart the service. A fourth failure inside the reset period does nothing, so a 7034 can follow a run of 7031s |
| No actions listed | The service isn't restarted by the SCM, and you may see 7034 rather than 7031 |
| A REBOOT action | The computer restarts on that failure. Find out whether that was intended before anything else |
| A RUN PROCESS action and a command line | A program runs on failure. Read what it is |
| A short reset period | The count in the event goes back to 1 sooner, so a high count means failures close together |
The count in 7031 and 7034 is "how many times", but the reset= period decides when the counter goes back to zero, so a service that fails once a week with a one-day reset shows "1 time(s)" every week. Read the count together with the dates from Step 3, not alone.
If a 7032 appears, the corrective action itself failed. Its text includes the action and the error, so decode the error the same way as Step 6.
Step 8: Look at the crash side (read-only)
The SCM only notices that the process is gone. The reason is on the other side. Start at the minute of the 7031 or 7034 and look in three places:
- The Application log. Windows Error Reporting records application crashes there; Microsoft's WER page describes the feature as one that "enables users to notify Microsoft of application faults, kernel faults, unresponsive applications, and other application specific problems." A crashed service process normally leaves an application error entry naming the faulting module, though what is written depends on the service and the Windows build.
- The service's own log. Many services write their own file or their own event log. A clean exit code and a message such as "shutting down because the license check failed" is a configuration problem, not a crash.
- The System log just before. A service that dies right after a reboot, an update, or a change to its account is a different case from one that dies at 3 a.m. on its own.
# Read-only: Application log entries from 2 minutes either side of one failure (replace the time)
$t = [datetime]'2026-11-20 03:14:00'
Get-WinEvent -FilterHashtable @{
LogName = 'Application'
StartTime = $t.AddMinutes(-2)
EndTime = $t.AddMinutes(2)
} -ErrorAction SilentlyContinue |
Where-Object { $_.LevelDisplayName -in 'Error','Warning','Critical' } |
Sort-Object TimeCreated |
Format-Table TimeCreated, Id, ProviderName, LevelDisplayName -AutoSize
# Read-only: the first lines of the messages in that window
Get-WinEvent -FilterHashtable @{ LogName='Application'; StartTime=$t.AddMinutes(-2); EndTime=$t.AddMinutes(2) } -ErrorAction SilentlyContinue |
Where-Object { $_.LevelDisplayName -in 'Error','Critical' } |
ForEach-Object { '{0:T} [{1}] {2}' -f $_.TimeCreated, $_.Id, (($_.Message -split "`n")[0..2] -join ' | ') }
wevtutil can do the same from a command prompt; Microsoft documents qe with /rd, /c, /f, and /q, its own example is wevtutil qe Application /c:3 /rd:true /f:text for the three newest Application events; swap in System for the SCM events.
Three outcomes:
| What you find | What it means | Next |
|---|---|---|
| An application error naming a faulting module in the service's own folder | The service process is crashing | The vendor, with the module, version, and time (Step 12) |
| An application error naming a system or third-party module | A shared component or an injected product is involved | Same, plus the product list on the server |
| Nothing in the Application log | The process exited or was ended without a crash record | The service's own log, then who or what stopped it (Step 12) |
Don't capture dumps first. A dump is a deliberate change (Step 12) and only worth it when the first three reads show a real crash that keeps happening.
Step 9: 1069, the account (read-only)
A 7023 that ends "The service did not start due to a logon failure." is not a crash at all. Microsoft's service user account page says "The SCM does not maintain the passwords of service user accounts. If a password is expired, the logon fails and the service fails to start." The older service startup permissions article lists the same pair, Service Control Manager Event ID 7000 with that text and Event ID 7013 with "Logon attempt with current password failed with the following error: Logon failure: unknown user name or bad password.", and names three causes: the password was changed on the account, the password data in the registry is damaged, or "the right to log on as a service is revoked for the specified user account."
# Read-only: services that run as a named account, and whether they are running
Get-CimInstance Win32_Service |
Where-Object { $_.StartName -and $_.StartName -notmatch '^(LocalSystem|NT AUTHORITY\\|NT SERVICE\\)' } |
Sort-Object StartName, Name |
Format-Table Name, StartName, StartMode, State, ExitCode -AutoSize
Then check the account itself on a domain controller or with the AD module (read-only):
# Read-only: the state of the account a service runs as (replace the name)
Get-ADUser -Identity svc-contoso-sync -Properties Enabled, LockedOut, PasswordExpired, PasswordLastSet, PasswordNeverExpires, LastLogonDate |
Format-List Name, Enabled, LockedOut, PasswordExpired, PasswordLastSet, PasswordNeverExpires, LastLogonDate
| Finding | Meaning | Next |
|---|---|---|
PasswordLastSet shortly before the first 7023 |
The password was changed and the service still holds the old one | Update the stored credential (Step 12) |
PasswordExpired is True |
Microsoft: an expired password makes the logon fail | Fix the account's password policy decision, then the credential (Step 12) |
Enabled is False or LockedOut is True |
The account state | the lockout post for who keeps locking it |
| Account is fine, and the error is still 1069 | The log on as a service right, or a local policy | Read the User Rights Assignment for the server (Step 12) |
StartName is a local account |
The password lives on that server | Check the local account on that server, not AD |
Step 10: 1068 and 1075, dependencies (read-only)
1068 says "The dependency service or group failed to start." and 1075 says "The dependency service does not exist or has been marked for deletion." The failing service isn't the real problem; something it needs is. Get-Service has -RequiredServices and -DependentServices, and each takes you one level.
# Read-only: what this service needs, and the state of each (replace the service name)
Get-Service -Name 'ContosoSyncAgent' -RequiredServices | Format-Table Status, Name, DisplayName -AutoSize
# Read-only: what depends on it
Get-Service -Name 'ContosoSyncAgent' -DependentServices | Format-Table Status, Name, DisplayName -AutoSize
# Read-only: walk the full required chain, depth first
function Get-Chain($n, $depth = 0) {
Get-Service -Name $n -RequiredServices -ErrorAction SilentlyContinue | ForEach-Object {
'{0}{1} [{2}]' -f (' ' * $depth), $_.Name, $_.Status
Get-Chain $_.Name ($depth + 1)
}
}
Get-Chain 'ContosoSyncAgent'
Then ask the same questions of the first stopped service in the chain: its 7023, its account (Step 9), its error. A dependency chain is read from the bottom up, and the event for the root service is the one that matters. If the chain names a service that no longer exists (1075), a removed product left a stale entry in the service's dependency list; that is a configuration change on the service (Step 12), not a reinstall.
Step 11: 1053, the start or stop timeout (read-only)
Microsoft's slow service article (KB 922918) says "The service control manager waits for the time that is specified by the ServicesPipeTimeout entry before logging event 7000 or 7011", and the Windows Trace Session Manager article gives the default: "By default, the timeout value is 30000 milliseconds (30 seconds)." So a 1053 or a 7000 or 7011 on start means the service did not report that it was running inside that window.
# Read-only: is a custom timeout already set? (absent means the default applies)
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control' -Name ServicesPipeTimeout -ErrorAction SilentlyContinue |
Select-Object ServicesPipeTimeout
# Read-only: is the Service Control Manager database locked?
sc.exe querylock
Microsoft's slow boot article ties a lock on the SCM database to a broad pattern: "none of the services can access the SCM database to initialize their service start requests", with sc querylock showing "IsLocked: True". If every slow service has a timeout together, and the lock shows, that is a different problem from one slow service.
| Pattern | Reading | Next |
|---|---|---|
| One service times out, the same one every boot | That service is slow: a dependency, a network wait, or resource pressure | Its own log, its dependencies (Step 10), then Step 12 |
| Many services time out in the same minute at boot | Machine-wide: storage, CPU, or a lock on the SCM database |
sc querylock, and the boot timeline |
| 1053 at stop, not at start | The control handler did not return in time (Microsoft: 30 seconds) | The vendor |
A custom ServicesPipeTimeout is already set |
Someone has already raised it once | Find out why before raising it again |
Microsoft's own advice on that registry value is the guard rail: "This workaround may resolve the problem where the service does not start. However, we recommend that you research this problem to determine whether it is a symptom of another problem." and "Increase the number carefully."
Step 12: Change one link (deliberate changes)
By now you should be able to say, in one sentence, which of these it is: a credential, a dependency, a timeout on one slow service, a crash in the service's own code, or recovery that is missing or wrong. Change the one link that sentence names, on the service that needs it, and write down the time.
| Finding | One change | What to avoid |
|---|---|---|
| 1069 after a password change | Update the stored credential on that service (Services console, or sc.exe config <service> obj= <account> password= <password>, which Microsoft documents with a required space after each equals sign), then start it |
Resetting the account's password again, or switching the service to LocalSystem to make the error go away |
| 1069 and the account is fine | Restore the "Log on as a service" right for that account through the policy that sets it (Microsoft's startup permissions article names the right) | Granting the right on one server by hand when a policy owns it |
| 1058, disabled | Set the start mode back to what the vendor ships (Set-Service -StartupType), only if the disabling was not intentional |
Enabling a service someone disabled on purpose |
| 1068 or 1075, dependency | Start or fix the root service first; remove a stale dependency entry only if the product is really gone (sc.exe config <service> depend= <names>) |
Reinstalling the dependent service |
| 1053, one slow service | Fix the slow dependency or resource problem; raise ServicesPipeTimeout only as Microsoft's workaround, in small steps, with a reboot |
A global five-minute timeout because one service is slow |
| 7031 or 7034, crash with a module | The vendor, with the module, version, time, and Application log entries; a vendor patch | Restart-forever recovery to hide the crash |
| Crash that needs a dump | ProcDump on that service's process: -e writes a dump on an unhandled exception and -w waits for the process to launch if it is not running, with -ma for a full dump |
A full dump of a production service without an owner and a place to put it |
| Recovery missing or wrong |
sc.exe failure <service> reset= <seconds> actions= restart/<ms>/restart/<ms>/""/<ms> for a bounded number of restarts |
A reboot action on a service that is not the whole point of the machine |
Two details from the Microsoft pages matter in practice. Both sc forms need a space after each equals sign: "A space is required between an option and its value (for example, actions= restart). If the space is omitted, the operation will fail." And reset= goes with actions=; the page says reset= "requires the actions= parameter."
# Change (bounded recovery, only after the crash cause is with the owner): restart at 1 minute, restart at 2 minutes, then no action; reset the count after one day
sc.exe failure Spooler reset= 86400 actions= restart/60000/restart/120000/""/0
sc.exe qfailure Spooler
# Change (only for a 1069 caused by a changed password; the prompt keeps the password out of the PowerShell history, but sc.exe still receives it as an argument)
$pw = Read-Host 'Service account password' -AsSecureString
$plain = [System.Net.NetworkCredential]::new('', $pw).Password
sc.exe config ContosoSyncAgent obj= 'CONTOSO\svc-contoso-sync' password= $plain
Remove-Variable plain, pw
Start-Service ContosoSyncAgent
Treat the second block as an example of the order, not a template: some environments store service credentials through a vault or a managed account, and then the credential is not changed on the server at all. Read how your team manages the account first.
Step 13: Prove it (read-only)
A manual start proves nothing: it works for the 10 minutes you watch it. Prove the specific thing you changed.
# Read-only: is the service up, and since when? (match the process start time to your change)
$svc = Get-CimInstance Win32_Service -Filter "Name='ContosoSyncAgent'"
$svc | Format-List Name, State, ProcessId, ExitCode
if ($svc.ProcessId) { Get-Process -Id $svc.ProcessId | Format-List Id, ProcessName, StartTime }
# Read-only: any SCM failure events for that service since the change (replace the time and the name)
$since = [datetime]'2026-11-20 09:30:00'
Get-WinEvent -FilterHashtable @{
LogName='System'; ProviderName='Service Control Manager'; Id=7000,7009,7011,7023,7024,7031,7032,7034; StartTime=$since
} -ErrorAction SilentlyContinue |
Where-Object { $_.Message -like '*Contoso Sync Agent*' } |
Format-Table TimeCreated, Id, @{n='Message';e={($_.Message -split "`n")[0]}} -AutoSize
Pass criteria:
- The service state is Running and the process start time is after your change and stays the same across the day. A start time that keeps moving is a crash loop with recovery on.
- No new 7023, 7031, or 7034 for that service, on any server that runs it, for a full business day and across at least one boot if the failure was boot-related.
- The Application log has no new application error for that process.
- For a recovery change,
sc.exe qfailureshows the settings you wrote, and a test of the corrective action was done on a non-production copy where possible. - The change, the time, the finding, and the person who owns the service are written in the ticket.
Common false starts
| What people do | Why it fails | Read this instead |
|---|---|---|
| Treat 7023, 7031, and 7034 as the same event | They say different things: error, crash with recovery, crash without a named action | Step 4 |
| Restart the service and close the ticket | The state is gone and the first failure is lost | Steps 3 to 8 first |
| Set recovery to restart forever | A crash loop that restarts quietly, burning CPU and filling the log | Step 7 |
| Add a reboot action | A server restart for one service fault, and a reboot loop if it recurs | Step 7 |
Raise ServicesPipeTimeout for a crash |
The timeout only governs start and control responses | Step 11 |
| Raise it for every slow service on the server | Microsoft says to research the cause first and to raise it carefully | Step 11 |
| Switch the service account to LocalSystem | Fixes the logon error by granting far more rights than the service had | Step 9 |
| Reset the service account's password on an AD account that is not the cause | Breaks every other place the password is stored | Step 9 |
| Read only the System log | The reason for a crash is in the Application log and the service's own log | Step 8 |
| Trust "It has done this 1 time(s)" | The count resets after the reset period, so it can say 1 every week | Step 7 |
| Declare it fixed after the first quiet hour | Many of these fail at 3 a.m. or on boot | Step 13 |
When a change is justified
| Change | Justified when | Not justified when |
|---|---|---|
| Update the stored service credential | A 1069 followed a password change and the account state is fine | The account is locked or disabled and nobody knows why |
| Restore the log on as a service right | The right was removed and a policy owns it | Someone wants to avoid fixing the password |
| Add bounded restart recovery | The crash is with the vendor and the service is needed in the meantime | The recovery would hide a crash nobody is working on |
Raise ServicesPipeTimeout
|
One service is genuinely slow to start and the cause is known | The services time out because the SCM database is locked |
| Add a reboot action | The machine is a single-purpose appliance and the service is its whole job | Any shared server |
| Capture a dump with ProcDump | A crash recurs and the owner has a place to receive the file | A one-time event with no pattern |
| Remove a stale dependency | The product is gone and the entry points at nothing | The dependency is only stopped |
| Reinstall the product | The vendor asked, after the module and version are known | It is the first idea |
FAQ
What is the difference between Event 7031 and 7034?
Both say a service terminated unexpectedly and give a count. 7031 adds "The following corrective action will be taken in %3 milliseconds: %5." Read Step 7 to see what the service is configured to do, rather than inferring it from which event appeared.
What does Event 7023 mean?
Microsoft's message is "The %1 service terminated with the following error: %2". The error is a Windows error code's text, such as 1067 "The process terminated unexpectedly." or 1069 "The service did not start due to a logon failure." Decode it with the table in Step 6.
How do I find out why a service crashed?
Not from the SCM event. Look at the Application log for the same minute, the service's own log, and what changed just before. Capture a dump only when the crash recurs (Steps 8 and 12).
Should I raise ServicesPipeTimeout?
Only for a service that is slow to start and for which you know why. Microsoft's article gives 60000 as an example value in milliseconds, requires a restart, and says to research the problem first. It has no effect on a service that crashes after starting (Step 11).
How do I check which service recovery actions are set?
Run sc.exe qfailure <service>. Microsoft's sc failure page defines the actions, the delays in milliseconds, the reset period in seconds, and the limit of three actions (Step 7).
Related posts
- Active Directory Account Keeps Getting Locked Out (when a 7023 logon failure is a service still holding an old password and the account keeps locking)
- Netlogon Event ID 5719 (when the failures only happen at boot and the machine cannot find a domain controller yet)
Free checklist
Adding restart-forever recovery, a global service timeout, or a nightly reboot before anyone read which event, error, and recovery setting the service had is a change made on every server at once. So is a Conditional Access policy enforced before anyone read the report-only results. The free Conditional Access pre-enforcement checklist keeps break-glass accounts, pilot groups, and report-only review on one page:
If you want the rest of the Intune runway written down for the team (enrollment hygiene, compliance phasing, break/fix cards and read-only PowerShell snapshots), the Intune & M365 Admin Starter Pack pairs with this triage: https://cashflow4375.gumroad.com/l/joonf?utm_source=devto&utm_medium=article&utm_campaign=aps_first_sale&utm_content=service-control-manager-events-7023-7031-7034
Admin Pack Studio; not affiliated with Microsoft. Steps 1-11 and 13 are read-only checks: Get-WinEvent, the event XML through ToXml(), Group-Object, Get-CimInstance Win32_Service, Get-Service with -RequiredServices and -DependentServices, sc.exe qfailure and querylock, Get-ItemProperty on the Control key, Get-ADUser, and Get-Process. Updating a stored credential, changing a start mode, editing a dependency, setting recovery actions, raising ServicesPipeTimeout, restarting a service, and capturing a dump are deliberate changes. Change one link at a time, write down the time, prove it for a full business day, and check current Microsoft Learn for version-specific behavior.
Top comments (0)