Howdy
I am working on a script to search 1 or more servers on a specific drive letter for a file type, or possibly more than 1 file type. I have found a coupe posted and tried to modify them to work but I am not having any luck.
I need to export the results as a CSV file and include the name of the computer that was searched, the full path, the file name including the extension of the file, and the size of the file, it would be great if it was in MB.
I've been working on using this but it just hangs. The drive sizes vary from 200gb to 1.6TB.
The best command I've found so far that works when I login locally and specify a path is the one below, but how can I put this in a script that will search remotely and specify only the drive letter instead of a full path?
gci -path c:\ -recurse -include *.txt |select-object fullname,lastwritetime|export-csv c:\temp\txtsearch.cvs