How can I read the Registry with WMI.NET? Should be like this (which is not working): SelectQuery q = new SelectQuery("SELECT * FROM Win32_Registry WHERE Key=HKEY_LOCAL_MACHINE\\SOFTWARE"); ManagementObjectSearcher searchProc = new ManagementObjectSearcher(scope, q); ManagementObjectCollection queryCollection1 = searchProc.Get(); foreach (ManagementObject m in queryCollection1) { // Display the remote computer information Console.WriteLine("Caption {0} Description : {1}", m["Caption"], m["Description"]); }
"aisman" wrote: > How can I read the Registry with WMI.NET? > > > Should be like this (which is not working): > SelectQuery q = new SelectQuery("SELECT * FROM Win32_Registry WHERE > Key=HKEY_LOCAL_MACHINE\\SOFTWARE"); > ManagementObjectSearcher searchProc = new > ManagementObjectSearcher(scope, q); > > > ManagementObjectCollection queryCollection1 = > searchProc.Get(); > foreach (ManagementObject m in queryCollection1) > { > // Display the remote computer information > Console.WriteLine("Caption {0} Description : {1}", > m["Caption"], m["Description"]); > > } > You can't do it that way, you need to use StdRegProv class (located in Root\Default) and it's methods: http://msdn.microsoft.com/en-us/library/aa393664(VS.85).aspx -- urkec