My task is to associate running services with process in Windows.
$a = Get-CimInstance -ClassName Win32_Service | Where-Object {$_.State -match "Running"} | Select-Object -Property ProcessId,Name
$b = Get-CimInstance -ClassName Win32_Process | Select-Object -Property ProcessId,Name
$d = @{$b.ProcessId=$b.Name}
$c = @{$a.ProcessId=$a.Name}
So, I get two hastables, and now I want to make new hashtable, that will consist of $a.Name and $b.Name, but from these values, where $a.processid=$b.processid.
Or may be somebody can advice how to combine value before putting them into hashtables.
Thanks