Can anyone shed light on why the following is occuring:

 Code:
$CMD="49,50,4d,2e,41,70,70,6f,69,6e,74,6d,65,6e,74,2e,43,6f,6e,64,65,63,6f,00,00"
$ = WRITEVALUE ("HKEY_CURRENT_USER\Software\Microsoft\Office\"+$MSO+".0\Outlook\Custom Forms\Compose","IPM.Appointment",$CMD,"REG_BINARY")


resulting in:

"IPM.Appointment"=hex:49,4e,00,4d,4f,e0,41,48,00,70,76,f0,69,6f,e0,74,7a,d0,65,6b,e0,74,76,e0,43,49,f0,6e,74,40,65,6b,30,6f,6f,00,00"

Which as you can see is nothing like what is required !