Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Thu, 28 Aug 2008 02:31:02 -0700,    group: microsoft.public.win32.programmer.wmi        back       


How can I read the Registry with WMI.NET?   
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"]);

                }
date: Thu, 28 Aug 2008 02:31:02 -0700   author:   aisman

RE: How can I read the Registry with WMI.NET?   
"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
date: Thu, 28 Aug 2008 04:01:02 -0700   author:   urkec

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us