Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


January 2005

Fingering More Eventtriggers

Improve your syntax for quick-draw accuracy
RSS
Subscribe to Windows IT Pro | See More Monitoring and Analysis Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

In "Pulling the Event Trigger" (December 2004, InstantDoc ID 44431), I introduced event triggers, a feature in Windows Server 2003, Windows XP, and Windows 2000 that lets you configure the OS to automatically run specified programs when certain event IDs occur. This month, let's finish our discussion of eventtriggers.exe with a look at further switch options.

Syntax Specifics
First, let's get specific about the /create syntax. Following is the proper Eventtriggers syntax to tell the OS to watch for any attempts to delete protected system files (which produces event ID 64002) and, if such an attempt happens, to send a pop-up message to a user named Jack whose password is swordfish:

eventtriggers /create /tr sysattack /eid 64002
   /ru jack /rp swordfish /tk "net send jack the
   system is under attack!"

But how can you specify Jack's account name? Unlike far too many Windows utilities, Eventtriggers recognizes both the domainname\username and username@domainname syntaxes. The bigfirm\jack and jack@bigfirm.biz formats work equally well.

How do you find out what event triggers your system has in place? Typing

eventtriggers /query

yields a simple list of the trigger IDs—numbers that identify each trigger's name and the command to execute if the trigger fires. You can add the /s systemname, /u username, and /p password options to access a remote system's event triggers list. Adding the /v (verbose) switch provides further details about the triggers. You can also use the /fo option if you want to format the output as a simple table (the default output format), a list, or a comma-separated value (CSV) file (using the table, list, and csv options, respectively). For example, to dump a verbose list of triggers as a CSV file, type

eventtriggers /query /fo csv /v

You'll need the trigger ID value to delete a trigger if you no longer want it on your system. To delete a trigger, you use the command

eventtriggers /delete /tid <triggerID>

To delete all triggers, you can use an asterisk (*). Or, you can stack several triggers you want to eliminate, as follows:

eventtriggers /delete /tid 1 /tid 5

Trigger Log
Before you get an itchy trigger finger, I'll warn you that event triggers aren't wonderful about telling you what they're doing. Debugging them can therefore be a bit mysterious. Windows offers one bit of help: CmdTriggerConsumer.log. Located in \windows\system32\wbem\logs, this ASCII text file records sparse information whenever someone creates or deletes a trigger, or when a trigger fails to work. In this log, you might see an entry such as the following:

Wed, Jul 07 2004 12:10:09 PM
TriggerName = sysattack
TriggerID = 1
Action = Failed to Trigger

Notice that the entry doesn't tell you why the trigger failed—only that it did. But such information can still be useful. As I worked with the examples for this two-part series of articles, I tried creating triggers that would run a Net Send command, but I never saw any of the pop-up windows that Net Send usually generates. I tested the syntax by typing the Net Send command directly from the command line, and it worked fine. I wondered whether the trigger was working. Or perhaps I'd messed up some aspect of the Eventtriggers syntax. Checking the log confirmed that the event had occurred, but the trigger had attempted an action and failed. Armed with that information, I tried adding the /ru and /rp options, forcing Eventtriggers to use my credentials rather than the LocalSystem account's credentials. Problem solved.

Homegrown Help
Many effective—but expensive—monitoring applications on the market can alert you or even proactively contact you when certain events happen on your system. But if you can't abide the high prices of such solutions, try using Eventtriggers to stitch together some nice homegrown help.

End of Article



Reader Comments
In using the this utility I found that the copy from an Xp Pro will not operate on a Windows 2000 Server. Is there a version of the utility that runs on 2000?

Thanks Jeff
jeff.jones@nchmd.org

jjonesfla January 05, 2005 (Article Rating: )


I looked around and did not see any supporting documentation about running eventtriggers.exe on Win2k. I copied a w2k3 .exe to w2k and got:
C:\>eventtriggers /query
ERROR: The target system must be running Windows XP or above.

I'm pretty sure Windows 2000 supports wmi consumers so I'm not sure what the issue is.

Ben

BenJammin January 05, 2005 (Article Rating: )


There is not one, unfortunately. I was SURE I'd seen a VBS version for 2000 but I mis-remembered. Apologies!
-- Mark

MarkMinasi May 13, 2005 (Article Rating: )


For those running Windows 2000 who would wish to implement this functionality, it can be done via a piece of VB.NET code. Of course you need to know a small bit about writing code but very little I promise. Have a look at the EventWritten event of the EventLog component. I bet if you found the code to eventtriggers.exe it would be using this routine.
.NET executables will run on Windows 2000. So basically what I am saying is build your own eventtriggers.exe if I like me you are still using Windows 2000.

Hope this helps.

Anonymous User May 26, 2005 (Article Rating: )


Along with the VB.NET option above I just posted have alook at this for another way of getting eventtriggers functionality onto Windows 2000 and others that run ActivePerl (freeware)
http://www.windowsitpro.com/WindowsScripting/Article/ArticleID/19828/19828.html

Anonymous User May 26, 2005 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Microsoft: Save Money ... By Paying for Software

Microsoft this week adopted an interesting tactic in its long-running battle with open source software: Businesses looking to save money over the long haul should simply pay for software instead of moving to free, open source solutions. The rationale? ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events How IE7 & The New Extended Validation SSL Certificates Impact Your Site

Concrete Ways to Make Sure Your SharePoint Deployment Doesn't Blow Up

Virtualization Management

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing