Stop pulling your hair out, use Process Explorer

How many times have you tried to open a file in Windows, only to see it is already in use by some another program? Thus begins the witch hunt of process destruction, until you can open the file.

Process Explorer gets rid of this problem. Just search for a file name, and it tells you which process has a hold of it. This is only a small piece of its functionality, but a huge piece of my sanity. Why doesn’t Windows Ship with all the SysInternals stuff?

Using Powershell for MD5 Checksums

The older I get, the more paranoid I get about things I download. Today I downloaded a freeware program from a 3rd party download site, since the publisher doesn’t actually allow downloading from their site. All they give is an MD5 checksum.

Well, I decided to write a quick Powershell script to do the checksum for me. (Got some pointers from another blog writing a cmd-let to do the same thing)

param
(
    $file
)
 
$algo = [System.Security.Cryptography.HashAlgorithm]::Create("MD5")
$stream = New-Object System.IO.FileStream($file, [System.IO.FileMode]::Open)
 
$md5StringBuilder = New-Object System.Text.StringBuilder
$algo.ComputeHash($stream) | % { [void] $md5StringBuilder.Append($_.ToString("x2")) }
$md5StringBuilder.ToString()
 
$stream.Dispose()

I probably should add a try/catch for the stream disposal and file existence validation. But, you get the picture.