Why doesn't powershell filter the output of an object's toString method?
Get-ChildItem cert:\localmachine\my | % { Select-String -InputObject $_.ToString() -Pattern 'testcert' -SimpleMatch }
Instead I just get everything I would normally get by running
Get-ChildItem cert:\localmachine\my | % { $_.ToString() }
I was expecting that like grep
or findstring
I would get just the lines that match the regex.
One would think that once $_.ToString()
is called, you would just get string output...instead, am I just getting objects, or an array of strings?