I've written a simple batch script that watches some services and regularly restarts them. I've used the eventcreate command to write to the Windows event log, which seems like a good way of logging my actions, but I notice that the 'category' field is always empty. Can I use this field to put some extra information in? There doesn't seem to be a parameter on eventcreate for it. Or is this reserved for some internal Windows data?
The event category isn't a free-form text field-- it's a numeric index (a WORD value, actually) into a table of values that are specified in an event message file (see http://msdn.microsoft.com/en-us/library/aa363649(VS.85).aspx for technical detail).
Basically, EVENTCREATE doesn't expose the Category value to you, so you can't set it. If you wanted to code something up that called the event logging APIs directly (http://msdn.microsoft.com/en-us/library/aa363654(VS.85).aspx) and you created an event message file you could certainly use Category. For something lightweight, though, you're probably just better off making up event IDs for your application that can be used for filtering and forget about Category.