up vote 5 down vote favorite
6
share [g+] share [fb]

This is something that's always bothered me, so I'll ask the Server Fault community.

I love Process Explorer for keeping track of more than just the high-level tasks you get in the Task Manager. But I constantly want to know which of those dozen services hosted in a single process under svchost is making my processor spike.

So... is there any non-intrusive way to find this information out?

link|improve this question
feedback

5 Answers

up vote 15 down vote accepted

Yes, there is an (almost) non-intrusive and easy way:

Split each service to run in its own SVCHOST.EXE process and the service consuming the CPU cycles will be easily visible in Process Explorer (the space after "=" is required):

SC Config Servicename Type= own

Do this in a command line window or put it into a BAT script. Administrative privileges are required and a restart of the computer is required before it takes effect.

The original state can be restored by:

SC Config Servicename Type= share

Example: to make Windows Management Instrumentation run in a separate SVCHOST.EXE:

SC Config winmgmt Type= own

This technique has no ill effects, except perhaps increasing memory consumption slightly. And apart from observing CPU usage for each service it also makes it easy to observe page faults delta, disk I/O read rate and disk I/O write rate for each service. For Process Explorer, menu View/Select Columns: tab Process Memory/Page Fault Delta, tab Process Performance/IO Delta Write Bytes, tab Process Performance/IO Delta Read Bytes, respectively.


On most systems there is only one SVCHOST.EXE process that has a lot of services. I have used this sequence (it can be pasted directly into a command line window):

rem  1. "Automatic Updates"
SC Config wuauserv Type= own

rem  2. "COM+ Event System"
SC Config EventSystem Type= own

rem  3. "Computer Browser"
SC Config Browser Type= own

rem  4. "Cryptographic Services"
SC Config CryptSvc Type= own

rem  5. "Distributed Link Tracking"
SC Config TrkWks Type= own

rem  6. "Help and Support"
SC Config helpsvc Type= own

rem  7. "Logical Disk Manager"
SC Config dmserver Type= own

rem  8. "Network Connections"
SC Config Netman Type= own

rem  9. "Network Location Awareness"
SC Config NLA Type= own

rem 10. "Remote Access Connection Manager"
SC Config RasMan Type= own

rem 11. "Secondary Logon"
SC Config seclogon Type= own

rem 12. "Server"
SC Config lanmanserver Type= own

rem 13. "Shell Hardware Detection"
SC Config ShellHWDetection Type= own

rem 14. "System Event Notification"
SC Config SENS Type= own

rem 15. "System Restore Service"
SC Config srservice Type= own

rem 16. "Task Scheduler"
SC Config Schedule Type= own

rem 17. "Telephony"
SC Config TapiSrv Type= own

rem 18. "Terminal Services"
SC Config TermService Type= own

rem 19. "Themes"
SC Config Themes Type= own

rem 20. "Windows Audio"
SC Config AudioSrv Type= own

rem 21. "Windows Firewall/Internet Connection Sharing (ICS)"
SC Config SharedAccess Type= own

rem 22. "Windows Management Instrumentation"
SC Config winmgmt Type= own

rem 23. "Wireless Configuration"
SC Config WZCSVC Type= own

rem 24. "Workstation"
SC Config lanmanworkstation Type= own

rem End.
link|improve this answer
3  
wow, awesome solution +1 – Matt Simmons Jun 2 '09 at 11:39
I have to agree. Thanks! I shall implement it soon – Randolpho Aug 24 '09 at 21:17
Just realized I never accepted this. So done! – Randolpho Mar 25 '10 at 14:57
1  
For the PowerShell users out there: Get-Service | ForEach-Object {C:\Windows\System32\SC.EXE config $_.Name type= own} – Tom Wijsman Apr 28 '10 at 13:30
@TomWij that's an answer on its own – GFK Aug 3 '11 at 10:02
feedback

While I don't know of easy way to do it directly, you can often infer it from the Process Explorer properties page for the svchost process. The Services tab on the process properties will tell you which services are hosted in that process. And the Threads tab will show you the threads and thread stacks running as well as their CPU usage. Often the Start Address on the thread will give an indication of the entry point DLL, and by extension the service, that's running on that thread. Other times you can look at the thread callstack and will see the module name in the call stack that tells you which piece of code is running.

link|improve this answer
feedback

I don't know if this is still a question you want answers, but while troubleshooting a customer's svchost error, I learned that there is a command line for exactly this: "tasklist /svc" It gives a complete list of the processes running, with the process ID and the services each process is running. It doesn't give a processor usage, but you can close them one process at a time by process ID, and learn at least which group of services is clogging up your CPU.

link|improve this answer
feedback

To the poster that recommended the PowerShell script: I tried it and it succesfully changed all my services. However, upon reboot an error box popped up and a restart was triggered. I had to restore with 'last good configuration'. Be careful.

link|improve this answer
feedback

rem DCOM Server Process Launcher DcomLaunch,

rem Plug and Play PlugPlay,

rem Power Power

rem RPC EndPoint Mapper RpcEptMapper,

rem Remote Procedure Call RpcSs

rem DHCP Client Dhcp,

rem Windows Event Log eventlog,

rem TCP/IP NetBIOS Helper lmhosts

rem Application Service AeLookupSvc,

rem Application Information Appinfo,

rem Certificate Propagation CertPropSvc,

rem Group Policy Client gpsvc,

rem IKE and AuthIP IPSec Keying Modules IKEEXT,

rem Server LanmanServer,

rem User Profile Service ProfSvc,

rem Task Scheduler Schedule,

rem System Event Notification Service SENS,

rem Remote Desktop Configuration SessionEnv,

rem Shell Hardware Detection ShellHWDetection,

rem Windows Management Instrumentation Winmgmt,

rem Windows Update wuauserv

rem COM+ Event System EventSystem,

rem Network List Service netprofm,

rem Network Store Interface Service nsi,

rem Windows Time W32Time

rem Network Connections Netman,

rem Distributed Link Tracking Client TrkWks,

rem Remote Desktop Services UserMode Port Replicator UmRdpService,

rem Desktop Window Manager Session Manager UxSms

rem Base Filtering Engine BFE,

rem Diagnostic Policy Service DPS

rem Cryptographic Services CryptSvc,

rem Workstation LanmanWorkstation,

rem Network Location Awareness NlaSvc,

rem Windows Remote Management WinRM

rem Remote Registry RemoteRegistry

rem Remote Desktop Services TermService

rem IPSec Policy Agent PolicyAgent

rem Windows Font Cache Service FontCache

Somewhere I read that not all services can run in their own memory, some have to be in shared memory such as EFS. The list above has processes running from a Windows 2008 server. Any suggestions/recommendations from the community. Thanks in advance for your efforts.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.