Find-LostItem Using PowerShell

24 Jul 2017

Recently I needed to find a file that one of my colleagues was having trouble locating.  On the basis that there are several mapped drives and multiple USB drives that were contenders for the location, I decided to use PowerShell to help me find the file.  I started by mapping drives to likely share folders and plugged in as many of the usb drives that I could.  Then I wrote the following script that would find all the connected drives and trawl through them.

On the basis that the PowerShell way is to make the command flexible and also context agnostic (by that I mean that it can work and make sense in all contexts) I called the command Find-LostItem, not Find-LostFile even though it was a file that I was looking for and provided a parameter to specify the PSProvider to use with a default of FileSystem.  I have also used the new (PowerShell 5) Write-Information to enable more information to be written to the host to complement the Write-Progress.  Write-Verbose could be used as an alternative.