Skip to content

Instantly share code, notes, and snippets.

Get-Service | ForEach-Object { $s = $_; $wmi = Get-WmiObject Win32_Service -Filter "Name='$($s.Name)'"; [PSCustomObject]@{ Type = 'Service'; Name = $s.Name; Id = $null; Path = $wmi.PathName; User = $wmi.StartName } } | Format-Table -AutoSize