Copy property value to registry key

Hello everyone,

I am trying to take the value from a property I’ve named Computer Model, defined as:

(string values of selects “Model from Win32_ComputerSystem” of wmi)

and place it in to a Reg_DWORD registry key.

This should be quite simple, but I cannot think of the actual action code to call the property of WMI and copy the string in to the registry.

Any assistance would be appreciated!

Matt Johnson

I was able to figure this out. For those who may need to perform the same task, here is an example of the code:
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Dir\Dir\Dir]” “Key”="{(string values of selects “Model from Win32_ComputerSystem” of wmi)}"

I’m curious, why are you copying this out to the registry?

Also, I would recommend using the following instead: (much faster than WMI and also works on Linux/Unix)

unique value whose(it != "") of (it as string as trimmed string) of values "product_name" of structures "system_information" of smbios

See this analysis for more examples: http://bigfix.me/analysis/details/2994751

1 Like

Hi jgstew,

Thanks for responding. We want to add a function in another application that will use this key for sorting. It cannot access WMI itself. I will try your code and see how it works out.

Thank you and Happy Holidays,
Matt Johnson

1 Like

But the other application can access the registry? What about the file system?

I don’t think there is any harm in writing this value to the registry, I was just curious why.

Also, it appears that this information is already available in the windows registry: http://stackoverflow.com/questions/12300442/how-to-get-computer-manufacturer-and-model-from-windows-registry-in-c