From PowerShell 1 on an XP Pro SP3 system, I have no trouble with your
original command. A couple of minor details that _shouldn't_ make a
difference, but can simplify things and improve matching:
(1) According to my system, the Responding property is boolean; check the
output of this:
Get-Process | Get-Member -MemberType Properties R*
That being the case, you might do better by comparing to $true than "true".
(2) I doubt you did anything in between that messed with the content of
$procs, but you can embed gps into your for loop if you wish, making certain
that it's fresh, like this:
foreach ($obj in gps) {if ($obj.Responding -eq $true){$obj.Processname}}
Just out of curiosity, try the above, then try your original command again
as well. I would almost think the problem is an issue with type coercion, if
I wasn't having it work fine as the string "true" on my test setup. Perhaps
this is something that was modified by the .NET 2 service pack? <== (wild
and highly improbable guess)
Post by JasonThanks for the input. I did find that I can use Where-object to do what you
did. I'm just not clear on why I don't can't pipe out the output of the
earlier command. It's a matter of finding why a foreach command doesn't push
anything to my pipeline. I'm still new to this, so I may be missing
something obvious.
Post by Justin Richgps | where {$_.responding -eq "true"} | ft -property processname,
responding
so, this should work.... but... it doesnt... perhaps Marco or Shay can
help...
when i do the above, it seems to return a valid set... but, if i replace the
true, with false, i get back the same data set... im not really helping
anything here, just asking more questions :)
Post by JasonPS version 1.0 release. Windows XP Corporate SP2.
I was trying to pipe it to a table format, so I could get, multiple values
foreach ($obj in $this) {if ($obj.Responding -eq "True")
{$obj.Processname,
$obj.Responding}} | ft
Post by Marco Shaw [MVP]Post by JasonWhy can't I pipe this through the pipeline?
PS C:\>$procs = gps
PS C:\>foreach ($obj in $procs) {if ($obj.Responding -eq "True")
{$obj.Processname}}
When I try to pipe it out, it tells me "An empty pipe element is not
permitted."
Odd...
Works fine here: XP SP2 with v2 CTP2.
OS? Posh version?
Marco
--
*Microsoft MVP - Windows Server - Admin Frameworks
https://mvp.support.microsoft.com/profile/Marco.Shaw
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com