Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
PowerShellでLinqのGroupJoinをするサンプル
$services = gcim Win32_Service | ? State -eq Running | select Name, State, ProcessId
$processes = ps | select Name, Id, CPU
[Linq.Enumerable]::GroupJoin( `
$services, `
$processes, `
[Func[Object,Object]]{ param($k) $k.ProcessId }, `
[Func[Object,Object]]{ param($k) $k.Id }, `
[Func[Object,[Collections.Generic.IEnumerable[Object]],Object]]{ param($o, $is) [PSCustomObject]@{ ServiceName = $o.Name; ProcessName = $is[0].Name; CPU = $is[0].CPU } })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment