Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Searching for certain files types on remote servers through Powershell is excruciatingly slow.

I am using this command

Get-ChildItem \\servername\e$\ -recurse -Filter *.txt

Is there a better way to search for files remotely?

share|improve this question

2 Answers 2

A much better approach would be to run the search locally on the machine that contains the files.

share|improve this answer
2  
If both systems are Win7/Server2008R2 you can run winrm quickconfig on the remote system. Then run something like invoke-command -computername remote01 -scriptblock {get-childitem ...} –  Chris S Aug 8 '11 at 12:54
    
Sure - which is running a search locally on the machine that contains the files. It doesn't need to be orchestrated from that machine; that's simply where the search needs to be run. –  mfinni Aug 8 '11 at 15:19
1  
Right, sorry if that came across strangely. Was just trying to give a concrete example of what you were proposing. That +1 you've got is from me; for giving what I would consider the "correct" answer. –  Chris S Aug 8 '11 at 15:29

Yes there is an extremely fast solution for that which offers the results in a second. Unless you look for a GUI search. It's called Everything. Give it at least a try.

When you are convinced by the ultimate speed then probably you can convince the author to provide an API for that.

If you need something effective in Powershell, then you are lost.


Edit There is an equal tool TFind (command line) that does the trick without an initial index. But it can't be simply used from remote. But you may to convince somebody to extend the system for remote calls.

share|improve this answer
    
The link goes to a tool called Everything...maybe needs edit or did you mean "Anything"? –  Bart Silverstrim Aug 8 '11 at 12:43
    
1. "No, 'Everything' only indexes local or removable NTFS volumes." 2. This works against an index; not the live file system. Definitely worth noting. –  Chris S Aug 8 '11 at 12:45
    
It needs an initial index. Then from there it is a live file system as it recognizes index changes. You don't have to use it when you say it's faster to iterate recursively through a remote folder structure... –  mailq Aug 8 '11 at 13:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.