Logman

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
npocmaka_
Posts: 517
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Logman

#1 Post by npocmaka_ » 07 Sep 2014 14:37

Logman is (one of the) a command rich not well documented options . This question provoked me to create an alert fired action.

This what's in the help:

Code: Select all

Options (alert):
  -[-]el                        Enable/Disable event log reporting.
  -th <threshold [threshold [...]]> Specify counters and their threshold
                                values for and alert.
  -[-]rdcs <name>               Data collector set to start when alert fires.
  -[-]tn <task>                 Task to run when alert fires.
  -[-]targ <argument>           Task arguments.
  -si <[[hh:]mm:]ss>            Sample interval for performance counter data
                                collectors.


So it turned out that the task is a scheduled task.Here is how you can create alert triggered command (will start notepad if cpu is loaded more than 5%):


Code: Select all

@echo off
:: requires admin permissions
::Creating an "on demand" task scheduled far in the past
SCHTASKS /create /tn notepad__task /tr "C:\Windows\notepad.exe" /sc ONCE /sd 01/01/1910 /st 00:00

logman stop notepad__ 2>nul 1>&2 & logman delete notepad__ 2>nul 1>&2
 
logman create alert notepad__ -th "\Processor(_Total)\%% Processor Time>5" -tn "notepad__task"
logman start notepad__


May be more than a half of the logman options are unclear to me (-mode , cfg adverb , what are the providers ,-mgt and so on... ).
If someone else has a willingness to share something will be glad to read (when I'm in the right mood to research more I'll share what I've found :-) , and may be for other unclear commands too.)

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Logman

#2 Post by penpen » 07 Sep 2014 17:06


Post Reply