How To Restart All The Services In Windows Server 2008
How to manually kill a Windows service process that is stack at "Stopping
" or "Starting
" country? Near Windows administrators accept faced a problem when they try to get-go/cease/restart a service, just information technology gets stuck with the Stopping (or Starting) status. You won't exist able to terminate this service from the Service management console (services.msc
), since all control buttons for this service become inactive (grayed out). The easiest way is to restart Windows, only it is not e'er adequate. Let's have a wait at alternative ways, which allows to forcefully kill a stuck Windows service or procedure without system reboot.
If within xxx seconds afterward trying to stop the service, it doesn't stop, Windows displays this message:
Windows Could not end the xxxxxx service on Local Computer Fault 1053: The service did not respond in a timely fashion.
The timeout that the Service Control Manager waits for a service to kickoff or stop tin can be changed by using the ServicesPipeTimeout registry parameter. If the service doesn't start inside the specified timeout, Windows sends an error to the Event Viewer (Event ID: 7000, 7009, 7011, a timeout was reached 30000 milliseconds). You can increment this timeout to 60 seconds, for example:
reg add together HKLM\SYSTEM\CurrentControlSet\Command /5 ServicesPipeTimeout /t REG_SZ /d 600000 /f
This is useful when starting/stopping heavy services that practise not have enough time to properly terminate all processes and close the files (for example, MS SQL Server).
If you try to stop such a service from the command prompt: net stop wuauserv
, a message appears:
The service is starting or stopping. Please try once again later on.
or:
Windows could not finish the Service on Local Reckoner. [SC] ControlService Error 1061: The service cannot accept control messages at this fourth dimension.
Contents:
- How to Strength Impale a Stuck Windows Service Using TaskKill?
- Force Finish a Stuck Windows Service with PowerShell
- Analyzing the Expect Bondage on Hung Services Using ResMon
- Killing a Hung Service Using Procedure Explorer
How to Force Kill a Stuck Windows Service Using TaskKill?
The easiest fashion to terminate a stuck service is to use the built-in taskkill command-line tool. First of all, you need to find the PID (process identifier) of the service. Equally an example, let's take the Windows Update service. Its system name is wuauserv
(you can check the name in the service properties in the services.msc
console).
Important. Exist attentive. Forced termination of disquisitional Windows services tin can event in BSOD or an unexpected system restart.
Run this command in the elevated command prompt (it is important, or access denied fault will appear):
sc queryex wuauserv
In our case, the PID of the wuauserv service is 9186.
To force impale a stuck process with the PID 9186, run the command:
taskkill /PID 9168 /F
SUCCESS: The process with PID 9168 has been terminated.
This control volition forcibly finish the service procedure. Now you can kickoff the service with the sc offset servicename
command or through the service management console
You tin stop a hung service more elegantly without manually checking the PID of the service procedure. The taskkill tool has the /FI option, which allows you to utilise a filter to select the necessary services or processes. You lot can kill a specific service with the control:
taskkill /F /FI "SERVICES eq wuauserv"
Or you can skip the service name at all and killing all services in a hung land with the command:
taskkill /F /FI "status eq non responding"
Afterward that, the service that is stack in the Stopping condition should cease.
You tin can also use the taskkill utility to force stop the hang services on a remote computer:
taskkill /S mun-fs01 /F /FI "SERVICES eq wuauserv"
Force End a Stuck Windows Service with PowerShell
You can also apply PowerShell to force the service to cease. Using the post-obit control, you tin get a list of services in the Stopping land:
Get-WmiObject -Class win32_service | Where-Object {$_.state -eq 'stop pending'}
Or in the Starting country:
Get-WmiObject -Grade win32_service | Where-Object {$_.state -eq 'first pending'}
The Stop-Process cmdlet allows terminating the processes of all institute services. The following PowerShell script will finish all stuck service processes on Windows:
$Services = Get-WmiObject -Class win32_service -Filter "state = 'stop awaiting'"
if ($Services) {
foreach ($service in $Services) {
try {
Stop-Process -Id $service.processid -Force -PassThru -ErrorAction Finish
}
catch {
Write-Alert -Message "Error. Error details: $_.Exception.Message"
}
}
}
else {
Write-Output "No services with 'Stopping'.status"
}
Yous must use the Become-CimInstance
instead of the Get-WmiObject
cmdlet in the new PowerShell Cadre six.x/7.x. Replace the showtime command of the script with:
$Services = Go-CimInstance -Class win32_service | where-Object state -eq 'end awaiting'
Analyzing the Wait Chains on Hung Services Using ResMon
Y'all can observe the process that caused the service to hang using the resmon.exe (Resource Monitor).
- In the Resource Monitor window, go to the CPU tab and find the hung service procedure;
- Select the item Analyze Wait Concatenation from the context menu;
- In the new window, you volition well-nigh likely meet that your process is waiting for another process. Finish the process. If you lot are waiting for the svchost.exe or another system process, you don't need to terminate it. Endeavour to analyze the wait chain for this process. Observe the PID of the process that your svchost.exe is waiting for and impale it.
Killing a Hung Service Using Process Explorer
Even the local administrator cannot end some processes that run under the SYSTEM business relationship. The fact is that the admin account only hasn't permissions on some processes or services. To terminate such a process (service), yous need to grant permissions to the service (process) to the local Administrators grouping and so kill them. To do this, we will demand two pocket-sized tools: psexec.exe and ProcessExplorer (bachelor on the Microsoft website).
- To start the ProcessExplorer with the system privileges (runas SYSTEM), use the command:
PSExec -due south -i ProcExp.exe
- In the Process Explorer process listing, notice the stuck service process and open up its properties;
- Go to the Services tab, notice your service and click the Permissions button;
- Grant the Full Control right in the service permissions for the Administrators group. Save the changes;
- Now try to stop the service process.
Please annotation, that the permission on the service is granted temporarily until it is restarted. To grant permanent permissions on service follow the article Set permissions on a Windows service.
How To Restart All The Services In Windows Server 2008,
Source: http://woshub.com/killing-windows-services-that-hang-on-stopping/
Posted by: matthiesaltrove88.blogspot.com
0 Response to "How To Restart All The Services In Windows Server 2008"
Post a Comment