Keith's profileKeith Hill's BlogPhotosBlogListsMore ![]() | Help |
|
December 11 Little Things in PowerShell - Determine Timespan of Files in a DirOften it is the "little things" that put a smile on your face. PowerShell does that for me a lot. Take for instance a simple little problem I ran into today while unit testing some code that generates log files. I wanted to know how long it took to write all the log files to disk. Due to the way the code works on a background thread, it wasn't particularly easy to use a System.Diagnostics.Stopwatch to do this. You could do this manually by inspecting the file dates (DateCreated and DateModified) in Windows Explorer but it only shows resolution down to minutes and I have to do the math myself. No good. Well this information is easy to figure out with PowerShell. Just CD into the log dir and execute: PS> $start = dir | foreach {$_.CreationTime} | sort | select -first 1 Days : 0 :-) Yes PowerShell can do all sorts of acrobatics WRT managing and querying a computer but it can also do the simple stuff in a pretty straight forward manner. December 01 Windows PowerShell Training WebcastSign up for some free PowerShell training via this TechNet webcast. Here’s the overview:"
I like these because you usually get some decent info for very little investment and if it doesn’t turn out to be right for you, you can bail easily with very little time lost. |
|
|