Monitoring the performance of individual window services

I have 7 window services. I want to control the performance of individual services, such as CPU usage, memory usage, etc.

If I use perfmon, it gives the whole system, but not separate services. Can anyone suggest how I can control the performance of individual services?

+5
source share
2 answers

Perfmon can track individual processes! Just select the process in the "Add Counters / Performance" combination. For "quick" monitoring, I found that Sysinternals (now Microsoft) Process Explorer is simple and enjoyable. Some services provide you with performance information (accessible by sockets / files, etc.) that can be displayed using tools such as MRTG or Cacti.

+3
source

To check the memory of individual services, you will have to change the types of services to "Own process". This Gist shows the complete code. The main idea is to try to change the type of service from the least intrusive to the most intrusive way:

$win32Service = Get-CimInstance -ClassName Win32_Service -Filter "Name = '$ServiceName'" -Verbose:$false

if ($win32Service)
{
    if (!(Set-ServiceTypeToOwnProcessByCim $win32Service))
    {
        if (!(Set-ServiceTypeToOwnProcessByWindowsRegistry $win32Service))
        {
            if (Grant-FullControlRightsOnServiceRegistryKeyToCurrentUser $win32Service)
            {
                Set-ServiceTypeToOwnProcessByWindowsRegistry $win32Service | Out-Null
            }
        }
    }
}
else
{
    Write-Warning "[$ServiceName] Service not found"
}

Set-ServiceTypeToOwnProcess.ps1 Enable-Privilege.ps1 script :

.\Set-ServiceTypeToOwnProcess.ps1 -ServiceName 'Appinfo', 'gpsvc', 'Schedule', 'SENS', 'SessionEnv', 'wuauserv'
+1

All Articles