The 'Task Category' you see in the UI is based upon the language of the OS. Under the hood an event just has a category ID. The UI maps it to the localized name for convenience. Personally I think you should stick with the ID as it is consistent across locales and will work even from remote machines.
You are not, at this time, able to filter on task category strings as this information isn't directly stored in the event source that Get-EventLog
(or even the newer Get-WinEvent
) commandlets use. The ID is the most efficient approach. But note that it is not recommended that you use Where-Object
with Get-EventLog
(or anything that returns lots of data) because it is a filter. It is applied AFTER the previous pipeline command executes and therefore you're retrieving ALL the event log data and then filtering in PS from there. The better option is to do the filtering using the Get-EventLog
filtering support directly. However you won't be able to filter by named category as that isn't stored in the event log data.