I am trying to filter the results of the logman command using powershell. I’ve tried to select a single property, filter using where-object, but it seems like the results from logman (stored in an array) are not accessible via their properties. Here are some commands I have tried so far:
logman -ets query #returns result
logman -ets query | select-object #returns result
logman -ets query | select-object -first 10 -Property Status #nothing
logman -ets | where-object {$_.Status -eq "Running"} #nothing
logman -ets | where-object {$_.Status -eq "Running"} #nothing
logman -ets | where-object {$_.Status -gt "R"} -debug #nothing
I am hoping to filter out just those sessions that pertain to my local service fabric emulator so I can get a handle on where my various service fabric logs are stored.
Any thoughts?
logman
, being an "external" command (one implemented as a .EXE file, rather than a PowerShell cmdlet), does not generate Objects within the meaning of the term in PowerShell. Instead, it generates a text stream, which you will have to parse. From the looks of it, the status is the last eight characters of the line, so you'll need to do something like
logman -ets query | Where-Object {-join $_[-8..-1] -eq "Running "}