Enterprise find files (via powershell) exclude Tempory Internet Files
I am trying to run this command via powershell on every computer on my network.
I am running into a problem with Temporary Internet Files, providing too many false positives.
Can anyone suggest a way to improve this command?
dir C:\Users\ /S /B | findstr /i "".t.st."" > "C:\test.txt"
One suggestion, was
dir C:\Users\ /S /B | findstr /i "".t.st."" > "C:\test.txt" dir C:\Users\ /S /B | findstr /i "".t.st."" | findstr ""Temporary Internet Files"" > "C:\test2.txt" fc C:\test.txt C:\test2.txt > C:\results.txt
But running through tests, it didn't give me the results I was looking for. I still had duplications. Or it would say the files are too different.
If you are running this through PowerShell then why not use PowerShell commands? Your examples are using the legacy DIR command. You could use Get-ChildItem instead. You can use -Exclude to skip a folder. You could use -filter or -include to find the files you want. Worse case is to get the files and then pipe to where object perhaps using a regex pattern to filter out the files you want. I can't tell from your commands what files you are looking for.