Put this at the top of your script.
$RC=setoption("WOW64AlternateRegView","On")

Short story, kix32 is a 32bit process and by default writes to HKLM\Software\wow324node. If you look there, you will see the value you are writing, because of redirection. Changing the option above gives you control over the normal software key.