Re: Perfmon and batch file

From: Pegasus \(MVP\) (I.can_at_fly.com)
Date: 12/06/04


Date: Tue, 7 Dec 2004 00:54:51 +1100


"Massimo" <Massimo@discussions.microsoft.com> wrote in message
news:76B36F32-4925-4DBD-BCEB-8E9AE428D442@microsoft.com...
> Hi and sorry for my english,
> I have w2003 server that have a process that many time totaly busy the cpu
> (move between 90 and 99%) ending to answer at the request.
> I need, any time, to kill the process and restart the service.
>
> To automatize this solution i have tried to use perfmon.
> I have made an alert with level at 70% and that as action insert voice in
> event viewer and run command file.
>
> This is the problem: The alert find an alarm, create voice in event viewer
> but no execute the cmd file or (I think!) execute it but not execute the
> command inside it.
> If i call manually the cmd file it work fine: kill process, wait some
second
> and the restart the service.
>
> How i can solve the problem?
>
> Thanks in advanced for any help.
>
> Massimo

You are probably making some assumptions in your batch file
that are not valid, e.g.
- that the account used by the batch file is authorised to kill your process
- that the commands used in the batch file are located in one of the
   folders described by the path.

Start with something simple, then build up on it. Here is an example:

@echo off
echo %date% %time% UserName=%UserName% >> c:\test.log
echo Path=%path% >> c:\test.log
c:\tools\kill -F SomeProcess 1>>c:\test.log 2>>c:\test.err

Now have a look at the two log files and all will become clear!