RE: How can I read the Registry with WMI.NET?
- From: urkec <urkec@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Aug 2008 04:01:02 -0700
"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
.
- Prev by Date: running remote process
- Next by Date: Handle Leak on Windows 2003 Server x64
- Previous by thread: running remote process
- Next by thread: Handle Leak on Windows 2003 Server x64
- Index(es):
Relevant Pages
|