<< Back to Script Library

Display SvcHost processes

This script looks at all of the services running under svchost.exe (a generic wrapper) and tells which service is using which wrapper.
Version: 1.0.1
Created: 2014-09-02
Modified: 2014-09-02
Creator: ControlUp Support
Downloads: 571
Tags: powershell services
The Script Copy Script Copied to clipboard
param (
    [string]$computer = "."
)
$results = (Get-WmiObject -Class Win32_Process -ComputerName $computer -Filter "Name='svchost.exe'" | % {
    $process = $_
    Get-WmiObject -Class Win32_Service -ComputerName $computer -Filter "ProcessId=$($_.ProcessId)" | % {
        New-Object PSObject -Property @{ProcessId=$process.ProcessId;
                                        CommittedMemory=$process.WS;
                                        PageFaults=$process.PageFaults;
                                        CommandLine=$_.PathName;
                                        ServiceName=$_.Name;
                                        State=$_.State;
                                        DisplayName=$_.DisplayName;
                                        StartMode=$_.StartMode}
     }
       }
)
$results