Skip to content

Instantly share code, notes, and snippets.

@JeffMill
Last active May 31, 2024 20:45
Show Gist options
  • Save JeffMill/dfb93c43cd3b020245b624be88c653c0 to your computer and use it in GitHub Desktop.
Save JeffMill/dfb93c43cd3b020245b624be88c653c0 to your computer and use it in GitHub Desktop.
List all services in a shared svchost
tasklist.exe /svc /fo csv `
| Select-String -Pattern '"(?<ImageName>.*)","(?<PID>\d*)","(?<Services>.*)"' `
| ForEach-Object -MemberName Matches `
| Select-Object `
@{Name='Image Name'; Expression={$_.Groups['ImageName'].Value}}, `
@{Name='PID'; Expression={[int]$_.Groups['PID'].Value}}, `
@{Name='Services';Expression={$_.Groups['Services'].Value}} `
| Where-Object {$_.'Services' -ne 'N/A' } `
| Format-List
@JeffMill
Copy link
Author

tasklist.exe /svc /fo csv  | ConvertFrom-Csv | Where-Object Services -ne 'N/A' | Format-List

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment