Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know how to search for files using dir/gci, but that only works across one drive AFAIK.

  • Is there a way to search across all drives on the computer?
  • Is there a way without manually enumerating then looping through the drives?
  • Is there a way to access the search indexes/services that are already available in windows, to speed up the search?
share|improve this question
$drive = get-psdrive
foreach ($a in $drive) {gci}

Not so bad... I can't think of a way without recursing all the drives like this, though.

See this page for info on searching the index.

share|improve this answer

This will list all ZIP files in decending size order by directory on all available drives:

get-psdrive -p "FileSystem" `
| % {write-host -f Green "Searching " $_.Root;get-childitem $_.Root -include *.ZIP -r `
| sort-object Length -descending}

Or search a specified list of Drives/Shares (e.g. C:, D: and \SERVER1\SHARE1...)

$paths="C:\","D:\","\\SERVER1\SHARE1" `
| % {write-host -f Green "Searching " $_;get-childitem $_ -include *.ZIP -r `
| sort-object Length -descending}
share|improve this answer

Not exactly answering your question (I don't know answer) but a question - do you have to use PowerShell? I've been a fan and avid user of Take Command from JPSoft for years (it used to be called 4DOS). You can certainly do this with TC.

share|improve this answer
nope, youre right, I dont have to use powershell. im just trying to make use of it where I can because its obviously a big part of the ms ecosystem now, and install by default, so its more of a learning thing – Schneider May 31 '09 at 13:44

Your Answer


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.