Biggest files? Oldest files? Duplicates?
I am guessing that, at one time or another, most of us have asked these questions of our file stores. Answers to these questions help us make informed decisions regarding storage management, archiving, etc. I know there are 3rd party apps out there that do this sort of thing. We have Storage Exec installed on an older server. It have a lot of functionality (much of which we don't use). Mainly, we use it to ask these simple questions. I thought, why pay money for something when you don't have to? Why install another app on your file server?
To that end, I am currently working on three PoSH scripts (functions) that will answer these questions. I pre-load these scripts in my PowerShell profile so that these functions are available just like cmdlets. It keeps them handy.
The first one I want to share is: Get-BigFiles
This function is pretty straightforward and simple. You can pass it a path, quantity in results, and minimum file size. It has some simple formatting to make the output (currently to console) a bit easier to read. It also reports back the time it took to run. I consider this version 0.10
Some things that are in my head include:
- Would using custom objects or arrays to store results make things easier to manage/report on/output/etc.? Other techniques?
- Want to be able to output to a file (HTML or TXT, for example).
- As I have stated before, I still think primarily in terms of VB. How would this script benefit from a more PowerShell-native approach?
- What other features would this script benefit from?
As of now, this script functions. It gives me the information I am asking of it. In that, it is successful. It may not be the most elegant, most 'correct' way of doing things. But, if you get the answer you need and are then able to move forward doing your job, then you have a tool of worth. I welcome comments and suggestions.