Here is a little UDF to do the conversion for you.

The unicode "set" is hard-coded, but this should work in most cases.

Code:
Function udfStrToRegBin($s)
While $s
$udfStrToRegBin=$udfStrToRegBin+DecToHex(Asc(Left($s,1)))+"00"
$s=SubStr($s,2)
Loop
$udfStrToRegBin=$udfStrToRegBin+"0000"
EndFunction



To use it, just paste the function at the end of your script and call it like this:
Code:
$rc=WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo","UserName",udfStrToRegBin("THE_LOGGED-IN_USER"),"REG_BINARY")