locked
WMI Query Access Denied. RRS feed

  • Question

  • Ok. So I tried googling this problem and it appears that Access Denied is a catchall for all issues regarding security, so I'm having trouble getting to the root of the issue.

    My code:

          ms_perm = new ManagementScope(@"\root\CIMV2");
          ms_perm.Options.EnablePrivileges = true;
          ms_perm.Options.Impersonation = ImpersonationLevel.Impersonate;
          mew_supp = new ManagementEventWatcher(ms_perm, new WqlEventQuery("SELECT * FROM Win32_ProcessTrace"));
          mew_supp.EventArrived += new EventArrivedEventHandler(mew_supp_EventArrived);
          mew_supp.Stopped += new StoppedEventHandler(mew_supp_Stopped);
    
          mew_supp.Start();

    Access denied occurs on the last line ("mew_supp.Start()"). I am not connecting to a remote computer, just trying to detect process launch on the computer.

    At first I didn't use a scope variable, however I found out this was a big no-no, so I made one and used it as seen above. Any ideas?

    Using:

    Windows 7 x64 Pro, Visual Studio 2010 Express

     

    Any help or ideas is much appreciated.


    Nosig
    Tuesday, April 20, 2010 7:24 AM

Answers