On Fri, Jan 29, 2010 at 12:20 PM, Simon Mbuthia <simon.mbuthia@gmail.com> wrote:
I had also removed the filter and it still behaved the same. I am 100000000% sure that the code is perfect, just like the C# snippet has vindicated. Anyway, I run the C# application and got the message below:

Unhandled Exception: System.UnauthorizedAccessException
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 e
rrorCode, IntPtr errorInfo)
   at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.Mo
veNext()
   at WMISample.MyWMIQuery.Main()

Still looks like something to do with permissions... but which user needs to have permission to what?? That's my question. My account has full permissions on wscript.exe, cscript.exe and even scrrun.dll

 
@Simon, try these and check permissions ( from run ) :
 

Wmimgmt.msc     ( and right click on properties. Click security tab and check root )

or

Wbemtest.exe

Your WMI log files are at : %SystemRoot%\system32\wbem\logs

Beyound this, as a learner am out of ideas. poolay! :-)