Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Performing an SQL-like JOIN operation

$
0
0

Good day,

I’d like to perform the equivalent of an SQL-like JOIN operation (i.e. not a UNION) in order to add the following fields:

  • Win32_Process.CommandLine
  • Win32_Process.Description

…to the following command output, which lists the processes with the top 10 private working set values.

Get-WmiObject -class Win32_PerfFormattedData_PerfProc_Process -Filter "Name <> '_Total'" | Sort-Object -Property WorkingSetPrivate -Descending | Select-Object -First 10 | Where-Object {$_.Name -Like $processName+"*"} | Select-Object @{Name="Process Id"; Expression = {$_.idprocess}}, @{Name="Counter Name"; Expression = {$_.name}}, @{Name="Private Working Set"; Expression = {$_.workingSetPrivate / 1kb}}

Do I have to loop through each of the above processes and performing multiple WQL queries, or is there a more elegant way of achieving the desired result?

Thanks,

Larry


Larry


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>