I am attempting to write a powershell script to loop through an entire directory structure and provide the filename, path, and line number of any potentially sensitive information that is contained in the file. When I run the code below, it looks like all of the individual objects in the directory are merged into one called inputstream. Why is this happening?
Code:
Get-ChildItem -Recurse | Get-Content -ErrorAction SilentlyContinue | Select-String -Pattern "key.=" | Format-Table FullName, Path, LineNumber, Pattern;
Output:
FullName Path LineNumber Pattern
-------- ---- ---------- -------
InputStream 1653 key.=
InputStream 2550 key.=
InputStream 3405 key.=
InputStream 4302 key.=
InputStream 4584 key.=