473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

hello guys..need help on wmi event handling..

Hi
i have written a vbscript to manage permanent event consumer classes of wmi ..
here i used the NTEventLogEventConsumer class to store the specific event notification in the windows event log...heres my script....

strComputer = "."
Set objWMIServices = GetObject("winMgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\subscription")
Set objEventFilterClass = objWMIServices.Get("__EventFilter")
Set objEventFilter = objEventFilterClass.SpawnInstance_()
objEventFilter.Name = "ProcessTrace"
objEventFilter.QueryLanguage = "WQL"
objEventFilter.Query ="SELECT * from __InstanceOperationEvent WHERE TargetInstance ISA 'Win32_ProcessTrace'"
objEventFilter.EventNamespace="root\cimv2"
objEventFilter.CreatorSID=Array(1,1,0,0,0,0,0,5,18 ,0,0,0)
objEventFilter.Put_()
Set objConsumerClass =objWMIServices.Get("NTEventLogEventConsumer")
Set objConsumer=objConsumerClass.SpawnInstance_()
objConsumer.Name="CONNTProcesstrace"
objConsumer.Category=0
objConsumer.SourceName="WinMgmts"
objConsumer.EventType=1
objConsumer.NumberOfInsertionStrings=2
objConsumer.CreatorSID=Array(1,1,0,0,0,0,0,5,18,0, 0,0)
objConsumer.InsertionStringTemplates=Array("%Targe tInstance.Name%","%TargetInstance.ProcessId%")
objConsumer.Put_()
Set objBindingClass=objWMIServices.Get("__FilterToCons umerBinding")
Set objBindingInstance=objBindingClass.SpawnInstance_( )
objBindingInstance.Consumer="CONNTProcesstrace"
objBindingInstance.Filter="ProcessTrace"
objBindingInstance.CreatorSID=Array(1,1,0,0,0,0,0, 5,18,0,0,0)
objBindingInstance.Put_()


now the script doesnt show any syntax error or runtime error....
but in the wbem log file it generates a message...

(Thu Feb 15 08:47:55 2007.711296) : Event subsystem was unable to perform the necessary operations to accomodate a change to the system state.
The state of the database may not reflect the state of the event subsystem (8004103A)

the error code "8004103A" refers to invalid object path...
but i cant figure it...which object path it reffering....
pls help me out of this...
Feb 15 '07 #1
3 3775
bartonc
6,596 Expert 4TB
The Visual Basic forum is here. Try posting your question there. This is the sys/admin for Windows forum. Not many programmers check here regularly. Good luck. Also, read Posting guidelines to learn how to use code tags. They make you post structure readable. You can edit your post for 5 minutes to try and get it right. Thanks.
Feb 15 '07 #2
Hi
i have written a vbscript to manage permanent event consumer classes of wmi ..
here i used the NTEventLogEventConsumer class to store the specific event notification in the windows event log...heres my script....
Expand|Select|Wrap|Line Numbers
  1. strComputer = "."
  2. Set objWMIServices = GetObject("winMgmts:" _
  3. & "{impersonationLevel=impersonate}!\\" & _
  4. strComputer & "\root\subscription")
  5. Set objEventFilterClass = objWMIServices.Get("__EventFilter")
  6. Set objEventFilter = objEventFilterClass.SpawnInstance_() 
  7. objEventFilter.Name = "ProcessTrace" 
  8. objEventFilter.QueryLanguage = "WQL"
  9. objEventFilter.Query ="SELECT * from __InstanceOperationEvent WHERE TargetInstance ISA 'Win32_ProcessTrace'" 
  10. objEventFilter.EventNamespace="root\cimv2"
  11. objEventFilter.CreatorSID=Array(1,1,0,0,0,0,0,5,18 ,0,0,0)
  12. objEventFilter.Put_()
  13. Set objConsumerClass =objWMIServices.Get("NTEventLogEventConsumer")
  14. Set objConsumer=objConsumerClass.SpawnInstance_()
  15. objConsumer.Name="CONNTProcesstrace"
  16. objConsumer.Category=0
  17. objConsumer.SourceName="WinMgmts"
  18. objConsumer.EventType=1
  19. objConsumer.NumberOfInsertionStrings=2
  20. objConsumer.CreatorSID=Array(1,1,0,0,0,0,0,5,18,0, 0,0)
  21. objConsumer.InsertionStringTemplates=Array("%TargetInstance.Name%","%TargetInstance.ProcessId%")
  22. objConsumer.Put_()
  23. Set objBindingClass=objWMIServices.Get("__FilterToConsumerBinding")
  24. Set objBindingInstance=objBindingClass.SpawnInstance_( )
  25. objBindingInstance.Consumer="CONNTProcesstrace"
  26. objBindingInstance.Filter="ProcessTrace"
  27. objBindingInstance.CreatorSID=Array(1,1,0,0,0,0,0, 5,18,0,0,0)
  28. objBindingInstance.Put_()
  29.  
now the script doesnt show any syntax error or runtime error....
but in the wbem log file it generates a message...

(Thu Feb 15 08:47:55 2007.711296) : Event subsystem was unable to perform the necessary operations to accomodate a change to the system state.
The state of the database may not reflect the state of the event subsystem (8004103A)

the error code "8004103A" refers to invalid object path...
but i cant figure it...which object path it reffering....
pls help me out of this...
Feb 15 '07 #3
bartonc
6,596 Expert 4TB
Cyberdyne:
There's no need to move this one. He's already copied the post there.
Feb 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Pavils Jurjans | last post by:
Hallo, I have been programming for restricted environments where Internet Explorer is a standard, so I haven't stumbled upon this problem until now, when I need to write a DOM-compatible code. ...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
106
by: xtra | last post by:
Hi Folk I have about 1000 procedures in my project. Many, many of them are along the lines of function myfuntion () as boolean on error goto er '- Dim Dbs as dao.database Dim Rst as...
8
by: Tim Geiges | last post by:
Since I am being challenged with learning c# I figured I could pass some of the pain on to you guys :-) I have another question(this one is important for me to fix before I can get my app to Beta)...
4
by: hillcountry74 | last post by:
Hi, I'm a newbie and trying to understand event handling in c#. I have understood handling events using delelgate objects. But not this method- "Event handling by overriding the virtual...
14
by: Kenneth P. Graci | last post by:
ok all you smart people and low level gurus how do i detect the close of a combbox's drop down list? there must be a way and i'm to dumb to figure it out.
4
by: mflll | last post by:
I am looking into the different techniques of handling arrays of edit boxes in Java Script. The first program below works fine. However, are there better ways of doing this, where the person...
10
by: Peter Michaux | last post by:
Hi, Today I have been testing the event models from Netscape 4.8 and IE 4 to the current crop of browsers. I'd like to write a small event library similar in purpose to the Yahoo! UI event...
0
by: ciffycyclops | last post by:
Hi i have written a vbscript to manage permanent event consumer classes of wmi .. here i used the NTEventLogEventConsumer class to store the specific event notification in the windows event...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.