PowerShell file hashing
So, I was reading the Microsoft Security Response Centres post on verifying your Windows Update files, available here, and saw their comments about using PowerShell to verify the upates. They used some code from Mike Wilbur's Blog, here, which is a nice simple little bit of code to get your SHA256 hashes for files.
I decided that the world needed something a bit more, and started to see if we could make a cmdlet that used the pipeline, and also checked the faile we were passing to the cmdlet actually existed. Whilst I was pokeing around in the .Net framework, I also noticed that SHA1, SHA384, SHA512, MD5 and RIPEMD160 was also available to us.
So I spent some time, and have developed the following piece of code:
To use the code, copy the code above into a .ps1 file, and then import-module yourfile.ps1, the function is called get-hash.
As you can see, I am using the comment based help, and there are some nice examples included.