Search the Community
Showing results for tags 'Reg Import'.
-
So I am trying to write a script that can take the current computer name and write it to a registry key. This key uses REG_BINARY type of key and looks like this: Value 1 Name: LocalName Type: REG_BINARY Data: 00000000 54 4f 55 47 48 42 4f 4f - 4b 36 30 39 38 00 00 00 TOUGHBOOK6098... 00000010 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000020 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000030 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000040 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000050 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000060 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000070 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000080 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 00000090 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000a0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000b0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000c0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000d0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000e0 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 000000f0 00 00 00 00 00 00 00 00 - ........ Its apparently very important that all the ending 00's are in there I found this out as I was working on some other keys that had to do with security settings, and if the key was say 01 00 00 putting any less or any extra ending zeros would cause the change in the regsitry to not effect the software. So what I am attempting to do is use the @ComputerName macro and plug it into a StringtoBinary() function and then write it to the registry. The challenge I face is how to fill in the entire binary value for the registry key and not just the converted strings value. I wonder if there is some easy code to do that. I imagine there must be a few ways but I am looking for the most straight forward/easiest. Also on a side note, instead of using RegWrite is there a way to create a .REG file that I can call from CMD with Reg Import? This is being done at an enterprise level and the users do not have access to write to the registry, but they can import a reg file via .bat or in my case a Autoit .exe with @ComSpec Currently I am importing all the "static" keys I need for configuration, but computer name is dynamic so that is why I am trying to find a way to use the @ComputerName macro to insert that value. Regards,