Friday, 26 July 2013

Searching all local drives for files using Windows Powershell

There's often a "forensic" side to software development. Unfortunately source control and continuous integration aren't going to be in place on all projects that you work on and, from time to time, you'll need to track down some elusive source code. I remember once helping to track down the source code for an important project on an old hard drive in the company owner's garage!

At the moment, I'm helping to pin down local copies of source code on some developers' PCs and needed a quick way of searching for all Visual Studio solutions on their hard drives. The following Powershell script searches recursively through all folders on all local drives for files with the ".sln" extension and outputs to a file.

Look at the script on github if you can't see the code in-line above.

The main challenge was getting the list of available drives. "Get-PSDrive -PSProvider FileSystem" will get you all local drives, but includes CD / DVD drives which might not be available. Filtering this list further using "Where-Object -Property Free" will restrict the list to available drives.

24 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This "Where-Object -Property Free" doesnt seem to exist. When I tested this I got this error: "Where-Object : A parameter cannot be found that matches parameter name 'Property'."

    Was this custom built?

    ReplyDelete
  3. Aw, this has been an extremely good post. In notion I have to set up writing in this way moreover ? taking time and actual effort to make a top notch article? but exactly what can I say? I procrastinate alot and also by no indicates seem to go done.

    ReplyDelete
  4. An impressive share, I recently given this onto a colleague who was simply performing a little analysis for this. And then he actually bought me breakfast because I ran across it for him.. smile. So well then, i?ll reword that: Thnx for any treat! But yeah Thnkx for spending some time to discuss this, Personally i think strongly concerning this and enjoy reading much more about this topic. If you can, as you grow expertise, could you mind updating your blog site with a lot more details? It is actually extremely of great help for me. Large thumb up in this blog post! Who Makes the Most Reliable Hard Drives? - NayaShopi

    ReplyDelete


  5. REALLY VERY EXCELLENT INFORMATION. I AM VERY GLAD TO SEE YOUR BLOG FOR THIS INFORMATION. THANKS FOR SHARING. KEEP UPDATING.
    Austere Technologies |Internet Of Things

    ReplyDelete
  6. Great article, really very helpful content you made. Thank you, keep sharing.

    Best Application Quality Management Services | Austere Technologies

    ReplyDelete
  7. Nice blog with excellent information. Thank you, keep sharing.

    Best Cloud Solutions | Austere Technologies

    ReplyDelete
  8. wow...nice blog, very helpful information. Thanks for sharing.

    Best Mobility Services | Austere Technology

    ReplyDelete
  9. Really great blog, it's very helpful and has great knowledgeable information.

    Best Software Security Services | Austere Technology

    ReplyDelete
  10. Wow...What an excellent informative blog, really helpful. Thank you.

    Best Software Services Company | Austere Technology

    ReplyDelete
  11. Our technical experts will offer you the help to download, install and reinstall the McAfee product on your system. McAfee also provides the support to resolve the key related errors as well as the issues related to system performance.
    mcafee.com/activate

    Our technical experts will offer you the help to download, install and reinstall the McAfee product on your system. McAfee also provides the support to resolve the key related errors as well as the issues related to system performance.
    mcafee.com/activate

    Office.com/setup – Let’s Get Started with Office Setup Installation by simply following the steps discussed below. You may easily activate Office with the help of Office Com Setup link.
    Office.com/setup

    Office.com/setup – Let’s Get Started with Office Setup Installation by simply following the steps discussed below. You may easily activate Office with the help of Office Com Setup link.
    Office.com/setup

    ReplyDelete
  12. aol mail
    Mail.aol.com - Login to your AOL E-mail
    by visiting Mail.aol.com and you may also do Aol Sign
    in, Aol Sign up, Aol Password Reset etc.

    ReplyDelete
  13. www.webroot.com/safe
    www.webroot.com/safe - Webroot is very
    well known for its immense security from the spyware,
    viruses. In order to protect your system from the
    spyware or any other cyber attacks, you can download
    webroot security tool online from www.webroot.com/safe.

    ReplyDelete
  14. Garmin.com/express
    Garmin.com/express - Register, Setup,
    Update and Manage your Garmin Devices Online by visiting
    www.garmin.com/express. Install Garmin Express
    with the help of Garmin.com/Express.

    ReplyDelete
  15. Roadrunner Support
    Roadrunner Email is a great web mail system
    that enable you to access your account using a PC, laptop
    or smartphone. Many individuals use Roadrunner email
    service for their professional and personal use.

    ReplyDelete
  16. Comcast Support
    Comcast Corporation is an American Global
    Telecommunication that offers cable television and
    broadcasting. In addition, they also provide services
    like internet, telephone and other wireless services.

    ReplyDelete
  17. If you are on a computer, you undoubtedly heard a lot about computer viruses as obvious of a concept that a computer virus.

    norton.com/setup

    ReplyDelete
  18. Get Started to activate office setup by visiting office website and enter office product key to verify it.If you already entered a product key and looking for your software, go to office.com/setup directly and click on my account page for office installation and manage your subscription.If you have not entered office product key yet, Follow steps for setup. Do not worry we will help you.

    www.office.com/setup

    ReplyDelete
  19. Garmin Express gives you the notifications as soon as the updates are available for your Garmin device. You can also sync with the Garmin connect by using the Garmin Express. Garmin Express helps you to transfer or upload your daily activities and data to your Garmin Connect account.

    garmin.com/express

    ReplyDelete
  20. Microsoft Office includes a wide range of desktop applications such as Word, Excel, Access, PowerPoint, Groove, OneNote, Publisher and Outlook which helps you to complete the various task easily such as writing a letter, sending an email and creating PowerPoint presentation.

    office.com/setup

    ReplyDelete
  21. McAfee Installation is such an easy or simple process as you have to make sure that above-mentioned prerequisites should be fulfilled before getting started with the McAfee Activation Process.

    mcafee.com/activate

    ReplyDelete