How do I get an unexpanded REG_EXPAND_SZ string from a remote registry?

Posted by dalehhirt on Stack Overflow See other posts from Stack Overflow or by dalehhirt
Published on 2010-03-30T20:52:09Z Indexed on 2010/03/30 20:53 UTC
Read the original article Hit count: 401

Filed under:
|
|

I am currently using RegistryKey.GetValue(string name, object defaultValue, RegistryValueOptions options) with RegistryValueOptions.DoNotExpandEnvironmentNames for the options value.

However, this is only valid when run on the local machine. Digging down via Reflector, I find it expands the strings locally. Which means that irrespective of the setting, the strings come down remotely already expanded.

Has anyone come across a solution to this that does not require running a process directly on the remote machine to get a REG_EXPAND_SZ value?

Update: I attempted to use WMI's StdRegProv provider to gain access, but it still expands the strings before sending them back.

© Stack Overflow or respective owner

Related posts about c#

Related posts about registry