Kaseya Community

read registry value that is different on each pc

  • I use a program called mailbell to check for new email on each users PC. The license code is stored in the registry, but the value name that is created depends on the license code that is entered. I am trying to pull that value from each PC so I can track my licenses, but since it is different on each PC I can't figure out how to pull it without doing 50 different checks (50 is how many licenses I have)

    The registry key is: HKLM\SOFTWARE\Emtec\Mailbell

    And the value on my PC is: License MB2/1F4C/1.1

    But the value on my co-workers is: License MB2/1F71/1.1

    And I can't just read the registry for HKLM\SOFTWARE\Emtec\Mailbell\License* to return all the values so I'm stuck.

    Any thoughts? I could even settle for exporting HKLM\SOFTWARE\Emtec\Mailbell to a file and then combine all the files to get all the individual values, but I don't see how to do that either.

    Thanks


    Legacy Forum Name: read registry value that is different on each pc,
    Legacy Posted By Username: sbennetta
  • sbennetta wrote:
    The registry key is: HKLMSOFTWAREEmtecMailbell

    And the value on my PC is: License MB2/1F4C/1.1

    But the value on my co-workers is: License MB2/1F71/1.1




    The easiest way I can think of this would be to create a vbscript that you execute, that reads the registry branch, and parses out the subkey, returning it as a text file that you can then read in and process.

    I can't think of an easier way, unless someone else can come up with something?


    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: Anthony Michaud
  • Actaully we made a kaseay script that calls regedit and exports the registry key to a txt file in the temp directory that contains:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Emtec\Mailbell]
    "License MB2/1F4C/1.1"=hex:4d,51,57,42,4e,2d,42,43,48,59,4f,2d,4b,53,48,2d,59,\
    4e,43,00

    All I want is the "License MB2/1F4C/1.1"

    We did the kaseya script so it would read the txt file and email the contents but all we get is:

    ÿþW

    I guess it's something with the way the registry value is saved because it is REG_BINARY.

    I then tried creating a VBscript that we could run on the txt file and pull just the information we wanted but it returns similar strange characters.

    Anyone have any thoughts why we are getting the strange characters, or a better way of doing this?

    Thanks.


    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: sbennetta
  • Here is your problem:

    REGEDIT dumps export files as UNICODE by default so you have to open them as UNICODE in VBScript:

    Set regFile = objFSO.OpenTextFile("myfile.reg",1,,-1)

    -1 tells the method to open as Unicode instead of ASCII (default).

    -Ed




    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: bellcpa