VBS code _JAVASCRIPT tips for monitoring registry changes through WMI

Source: Internet
Author: User
Google "VBS monitor Registry", Top 5 is the same code, I checked, the source is Hey, scripting guy! Blog on an article called "How Can I Monitor Changes to a Registry Key" articles, really shameless.


Article I have no time to translate, paste the code:
Copy Code code as follows:

StrComputer = "."

Set objWMIService = GetObject ("winmgmts:\\" & StrComputer & "\root\default")
Set Colevents = Objwmiservice.execnotificationquery _
("SELECT * from RegistryKeyChangeEvent WHERE hive= ' HKEY_LOCAL_MACHINE ' and" & _

"Keypath= ' Software\\microsoft\\windows\\currentversion\\run '")
Todo
Set objlatestevent = colevents.nextevent
WScript.Echo Now & ": The registry has been modified."

Loop in fact, there are 4 classes in WMI that can monitor the registry, respectively

    • registryevent
    • registrytreechangeevent
    • registrykeychangeevent
    • registryvaluechangeevent

See the class name to know what is to do, the above code used is registrykeychangeevent, that is, registry keys to change events.

I don't want to talk about the use of WMI events here, it's a very basic thing, and I don't want to translate reference documents, and if I don't understand this simple English, I don't need to use WMI. I think the hardest part about WMI is that there are too many classes inside, and many times you don't know which class to use to implement the desired functionality. And now, which class is already very clear, this article can also be concluded.

Reference Links: registering for System Registry Events

Original: http://demon.tw/programming/vbs-wmi-monitor-changes-to-a-registry-key.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.