Tweaked from http://www.van-lieshout.com/2009/12/match-vm-and-windows-harddisks-using-powercli/ to be more modern and with more error checking.