Use Get-Counter on \Process(*)\% Processor Time to see live per-process CPU, or Get-Process sorted by CPU for cumulative time. For svchost.exe, map the PID to its services with Get-CimInstance Win32_Service. Common causes are Windows Update and TiWorker, Defender scans, IIS application pools and SQL Server queries.
Symptoms
- Task Manager shows CPU at or near 100%
- Remote Desktop sessions are sluggish
- IIS sites or SQL queries slow down
How to diagnose it
Live per-process CPU
Divide by the number of logical processors to get a share of the whole machine.
(Get-Counter '\Process(*)\% Processor Time').CounterSamples | Where-Object InstanceName -notin '_total','idle' | Sort-Object CookedValue -Descending | Select-Object -First 10 InstanceName, @{n='CPU';e={[math]::Round($_.CookedValue / $env:NUMBER_OF_PROCESSORS, 1)}}Total CPU
Samples total processor time every 2 seconds.
Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 2 -MaxSamples 5Map svchost to services
Shows which services share the busy svchost process.
Get-CimInstance Win32_Service -Filter "ProcessId = PID" | Select-Object Name, DisplayNameMap w3wp to an IIS app pool
Identifies which site is busy.
Import-Module WebAdministration Get-ChildItem IIS:\AppPools | ForEach-Object { $_.Name; (Get-WebAppPoolState $_.Name).Value } & "$env:windir\system32\inetsrv\appcmd.exe" list wp
Common causes and fixes
Windows Update (TiWorker, TrustedInstaller)
Usually temporary while updates install. Let it finish, then reboot; schedule updates in a maintenance window.
Microsoft Defender scanning (MsMpEng)
Schedule scans off-peak and add exclusions only for well-understood paths such as database files.
Set-MpPreference -ScanScheduleTime 02:00:00
Add-MpPreference -ExclusionPath 'D:\SQLData'IIS application pool (w3wp)
Find the busy pool, check the application’s logs, and recycle the pool while you investigate.
Restart-WebAppPool -Name POOLNAMESQL Server queries
Find the most expensive queries with sys.dm_exec_query_stats and add indexes.
Prevent it happening again
- Alert when CPU_overall is above 90% for 10 minutes; the Statance Windows agent reports CPU and top processes.
- Keep top-process history to see which process caused a spike overnight.
Set it up: Windows Server monitoring.
FAQ
Why does Get-Process CPU not match Task Manager?
Get-Process CPU is total processor seconds since the process started, not current usage. Use Get-Counter for live percentages.
Is it safe to end svchost.exe?
No. It hosts system services; stop the specific service instead.
Related guides
Get alerted before this becomes an outage.
Install the agent in one line. Statance watches CPU, memory, disk and services, and its AI assistant helps find the cause.