It was brought to me the other day.  

“We have this file buried in an old server, only thing we know about it is the day it was created.  But we need it now…”

*** NOW ***

Ever had one of those?

Well this was not an issue.  We did know the type of file it was, we just had to dig through 125,641 copies in hundreds of subfolders, Sure, easy…


But it was actually, because I had Powershell.


Now I could have sat down and done some really cool script but you don’t have to get fancy with Powershell to get the job done.  And remember you can ALWAYS refine it later.

So I needed to just put this down as I was thinking it


“I want a list of ALL the files in the Archive.”



“Ooops… wait a minute… I want a listing of all WORD documents in that structure.”



“Better…but actually just the ones made in 2003…”

GET-CHILDITEM D:BIGHONKINARCHIVE –include *.DOC –recurse | where { $-.LastWriteTime.Year –eq ‘2003’ }


“Ok this is nice smaller list, but really I want the stuff done in November 2003”

GET-CHILDITEM D:BIGHONKINARCHIVE –recurse | where { ($-.LastWriteTime.Year –eq ‘2003’) –and ($-.LastWriteTime.Month –eq ‘11’)}


“Ooooo, now could I just have the ones done on the 26th?”

GET-CHILDITEM D:BIGHONKINARCHIVE –recurse | where { ($-.LastWriteTime.Year –eq ‘2003’) –and ($-.LastWriteTime.Month –eq ‘11’) –and ($-.LastWriteTime.Day –eq ‘26’) }


Now the first part I should state is this is NOT the most efficient way to do it.  But what it DOES show is you can easily use Powershell as an amazing search tool to mine through your folders.   And more importantly, you can write it out as you’re thinking about it the WAY you’re thinking about it.

You could even (with a little pipe) have Powershell examine the contents of those files and determine which ones might have the content you needed.


Oh somedays I wonder, what was life like BEFORE Powershell?

Oh yes, right.  I forgot.

It was horrid.


Thanks Powershell!

The Energized Tech