Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. Event Notification using Windows MAnagement Instrumentation

Event Notification using Windows MAnagement Instrumentation

Scheduled Pinned Locked Moved COM
databasehelp
14 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O oshah

    abhiramsss wrote:

    hr = pclsObj->Get(L("TargetInstance.Name"), 0, &vtProp, 0, 0);

    I doubt you can get the TargetInstance.Name this way. I'd Get the TargetInstance, put that into a IWbemClassObject, then call Get again to retrieve the Name property of TargetInstance.

    A Offline
    A Offline
    abhiramsss
    wrote on last edited by
    #3

    I want to display a message when a process is closed can u please advice me regarding this. Thanks in Advance abhi

    O 1 Reply Last reply
    0
    • A abhiramsss

      I want to display a message when a process is closed can u please advice me regarding this. Thanks in Advance abhi

      O Offline
      O Offline
      oshah
      wrote on last edited by
      #4

      Once you've got the ProcessID, open up a handle to it and wait on it. I *think* :~ you can get the process handle directly by Win32_Process::Handle, but in case you can't OpenProcess/WaitForSingleObject will work.

      A 3 Replies Last reply
      0
      • O oshah

        Once you've got the ProcessID, open up a handle to it and wait on it. I *think* :~ you can get the process handle directly by Win32_Process::Handle, but in case you can't OpenProcess/WaitForSingleObject will work.

        A Offline
        A Offline
        abhiramsss
        wrote on last edited by
        #5

        Hi iam working on WMI(windows MAnagement Instrumentation). i have created a sample application using WIn32_process class . iam able to display messages when an Process is opened or closed. now what i want to do is to create an object and then register a call back function . This class also take process names through another method . this class should call the above callbackfunction when one of the process(taken through the above method) is either started or exited. can you please suggest me how to procedd with this task. Thanks in advance abhi

        1 Reply Last reply
        0
        • O oshah

          Once you've got the ProcessID, open up a handle to it and wait on it. I *think* :~ you can get the process handle directly by Win32_Process::Handle, but in case you can't OpenProcess/WaitForSingleObject will work.

          A Offline
          A Offline
          abhiramsss
          wrote on last edited by
          #6

          HI i want to create a wrapper class of win32_Process class and i want to define my own methods into that wrapper class and after that i want to display messages whenever a new process is started or class using that wrapper class . Can you please suggest how to procedd with this Thanks in Advance abhi

          1 Reply Last reply
          0
          • O oshah

            Once you've got the ProcessID, open up a handle to it and wait on it. I *think* :~ you can get the process handle directly by Win32_Process::Handle, but in case you can't OpenProcess/WaitForSingleObject will work.

            A Offline
            A Offline
            abhiramsss
            wrote on last edited by
            #7

            Can u please suggest me how to write call back function for Event notification whenever a new process is executed using WMI Thanks Abhi abhi

            O 1 Reply Last reply
            0
            • A abhiramsss

              Can u please suggest me how to write call back function for Event notification whenever a new process is executed using WMI Thanks Abhi abhi

              O Offline
              O Offline
              oshah
              wrote on last edited by
              #8

              Let's start off with a little modification of your original code. Use this WMI query instead, "Select * From Win32_ProcessStartTrace" to get notified of process creation. Now to receive notification whenever a new Win32_ProcessStartTrace is fired, you need to invoke that WMI query with ExecNotificationQueryAsync. This operates almost exactly like ExecNotificationQuery, except it takes one extra parameter: a pointer to your implementation of IWbemObjectSink. If you don't have an implementation of IWbemObjectSink, just use the stock implementation from MSDN[^] or Codeproject[^]. But why do you need to be notified when a new process is being created? What are you going to do to the process?

              A 1 Reply Last reply
              0
              • O oshah

                Let's start off with a little modification of your original code. Use this WMI query instead, "Select * From Win32_ProcessStartTrace" to get notified of process creation. Now to receive notification whenever a new Win32_ProcessStartTrace is fired, you need to invoke that WMI query with ExecNotificationQueryAsync. This operates almost exactly like ExecNotificationQuery, except it takes one extra parameter: a pointer to your implementation of IWbemObjectSink. If you don't have an implementation of IWbemObjectSink, just use the stock implementation from MSDN[^] or Codeproject[^]. But why do you need to be notified when a new process is being created? What are you going to do to the process?

                A Offline
                A Offline
                abhiramsss
                wrote on last edited by
                #9

                thanks for your suggestion i will try to implement it. actually iam working on a network. so now i want to display messages remotely . Saty there aretwo machines A and B so whenever a exe is executed on machine B it should display message on machine A, so please suggest me how to work remotely using WMI. Thanks in Advance abhi abhi

                O 1 Reply Last reply
                0
                • A abhiramsss

                  thanks for your suggestion i will try to implement it. actually iam working on a network. so now i want to display messages remotely . Saty there aretwo machines A and B so whenever a exe is executed on machine B it should display message on machine A, so please suggest me how to work remotely using WMI. Thanks in Advance abhi abhi

                  O Offline
                  O Offline
                  oshah
                  wrote on last edited by
                  #10

                  I thought Windows already provided this functionality via the Event logs. System Policy editor (gpedit.msc) -> Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Audit Policy -> Audit process tracking (audit success). :doh: Unfortunately, this option also audits a heap of other events, in addition to process startup/shutdown.

                  A 4 Replies Last reply
                  0
                  • O oshah

                    I thought Windows already provided this functionality via the Event logs. System Policy editor (gpedit.msc) -> Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Audit Policy -> Audit process tracking (audit success). :doh: Unfortunately, this option also audits a heap of other events, in addition to process startup/shutdown.

                    A Offline
                    A Offline
                    abhiramsss
                    wrote on last edited by
                    #11

                    Hi, Can u please suggest me how to get WMI data from a remote computer Can u please suggest me the changes i have to do in Connectserver Function and the required DCOM settings required to access data remotely. Thank you Abhi abhi

                    1 Reply Last reply
                    0
                    • O oshah

                      I thought Windows already provided this functionality via the Event logs. System Policy editor (gpedit.msc) -> Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Audit Policy -> Audit process tracking (audit success). :doh: Unfortunately, this option also audits a heap of other events, in addition to process startup/shutdown.

                      A Offline
                      A Offline
                      abhiramsss
                      wrote on last edited by
                      #12

                      hi iam trying to access remote data using the following arguments in ConnectServer hres = pLoc->ConnectServer( _bstr_t(L"\\\\test\\root\\cimv2"), _bstr_t(L"kumar"), // User name _bstr_t(L"Keta001"), // User password _bstr_t(L"MS_409"), // Locale NULL, // Security flags _bstr_t(L"CRAFT"), // Authority 0, // Context object &pSvc // IWbemServices proxy ); where test is the name of testPC kumar is the username of remote PC Keta001 is the password CRAFT is the domain name but when iam running my application iam getting error cannot be connected error code 80041008 can u please suggest how to solve this. Thanks In Advance abhi

                      1 Reply Last reply
                      0
                      • O oshah

                        I thought Windows already provided this functionality via the Event logs. System Policy editor (gpedit.msc) -> Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Audit Policy -> Audit process tracking (audit success). :doh: Unfortunately, this option also audits a heap of other events, in addition to process startup/shutdown.

                        A Offline
                        A Offline
                        abhiramsss
                        wrote on last edited by
                        #13

                        hi when iam tryig to acquire UPS data using WIN32_UninterruptiblePowerSupply class of WMI ,iam not able to get the output,and i have searched on net for the solution , what i found is Most UPS's now days disable native OS support when they install, because they want to use their agent program instead. A good example is APC. So if your using an APC by default it turns off UPS support (Maybe MS needs to beef up the UPS support so APC doesnt feel they need to do this for functionality). So in this case WMI wont be any help. But IF your UPS uses the built in UPS support Windows provides then you should be ok can u please elaborate on this and tell me how to get UPS data. Thanks in Advance abhi

                        1 Reply Last reply
                        0
                        • O oshah

                          I thought Windows already provided this functionality via the Event logs. System Policy editor (gpedit.msc) -> Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Audit Policy -> Audit process tracking (audit success). :doh: Unfortunately, this option also audits a heap of other events, in addition to process startup/shutdown.

                          A Offline
                          A Offline
                          abhiramsss
                          wrote on last edited by
                          #14

                          Hi iam working on winows 2003 clustering and i have to use WMI. can u please help me with waht all we can do with WMI wrt to clustering and can i have sample scripts Thanks in advance

                          abhi

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups