|
|
|||||||
Hi, What am I doing wrong here ? I want to write hexadecimal to the reg key "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo" on subkeys "Company" and "UserName" the value "AAA". It doesn't write it hexadecimal but in a unknown value (false characters) ! $rc=WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo","UserName",AAA,"REG_BINARY") $rc=WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo","Company",AAA,"REG_BINARY") Thanks ! |
||||||||
|
|
|||||||
Hi there and welcome to the board, you might try to enclose the value in quotes [edit: sorry, forget my answer ] |
||||||||
|
|
|||||||
jochen, it's a good answer. question 1, why do you write twice there? question 2, how do you get AAA value there? it does not let me do other than "AAA0" you should read the correct value with kixtart and use that as the value what you write. |
||||||||
|
|
|||||||
Hmmm... You have to write it in Unicode. Give this a try: Code: $rc=WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo","Company","4100410041000000","REG_BINARY") |
||||||||
|
|
|||||||
That's the right solution ! Write the stringin Unicode ... But how can I translate a ASCI string to Unicode ? I would like "dynamically" translate the logged-in user to the $rc=WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo","UserName","THE_LOGGED-IN_USER","REG_BINARY") Can yoy help me with this ? Thanks |
||||||||
|
|
|||||||
Please take a look here, there is already a posted UDF that works just fine for me. http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=83554&page=35&view=collapsed&sb=3&o=all&fpart=2&vc=1 |
||||||||
|
|
|||||||
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) 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") |
||||||||
|
|
|||||||
It works ... Thanks for the replies ! |