none
My script failed but my Task says it succeeded RRS feed

  • 问题

  • I defined a ConsoleTasks in MP just like follows:

    <Presentation>
        <ConsoleTasks>
          <ConsoleTask ID="IB.Blade.PowerOff" Accessibility="Public" Enabled="true" Target="IBMxSystems!IBM.SystemX.BladeSystem" RequireOutput="true" Category="MonitoringObject">
            <Application>%WINDIR%\SYSTEM32\cscript.exe</Application>
            <Parameters>
              <Parameter>/nologo "%IBM_DIR_VBS%\IBMBladePowerTask.vbs" $Target/Property[Type="IBMxSystems!IBM.SystemX.Platform"]/SystemUUID$ IBM.BladeCenter.PowerOff.Blade $Target/Host/Property[Type="IBMxSystems!IBM.WinComputer"]/Licensed$</Parameter>
            </Parameters>
            <WorkingDirectory  />
          </ConsoleTask>
        <ConsoleTasks>

        ...
    <Presentation>

    but seems that I did not get the task failure info when there is a poweroff error. I searched related blogs and might got the reason:Task Status has two states Success or Fail, the way this is mapped from the 4 states that the module can return is that only Fatal Errors result in Failed tasks.  Since this module is used in both rules and tasks and in the rule case we do not want to unload we only return Fatal Errors if the problem is deemed to be unrecoverable, meaning the next time the module runs there is no chance it will complete successfully.

    here is the link of the blogs: http://blogs.technet.com/b/momteam/archive/2008/05/08/my-script-failed-but-my-task-says-it-succeeded.aspx

    But I do not know how to solve my own problem via this method for I am a new SCOM user, I even cannot find the script module configuration to put the given XML code, or have no idea if there are some other resolutions.

    if you have a good idea, reply me, great thanks!!

    2011年7月26日 6:12

答案

  • I recommand you use Agent Task, but not ConsoleTask.

    The different is ConsoleTask running locally on Console machine.

    AgentTask will distribute to each machine where your task target instance running on.

     

    Than about your task failure, first, Task succeed execute the script, then script fails, this is nothing related SCOM, SCOM doesn't parse your task output and analyze it and think your task successfully executed.

    Task only failes when SCOM failed to start your script.

    Here is a solution not resolve your issues but does helps a little: use"Agent Task\Command Line" template, since CMD have StdOut and StdErr, and SCOM does parse CMD output and show them in different section, you know whether your script succeed or failed at one glance.


    Haitao Chen (haidaocht # gmail.com)
    • 已标记为答案 Eronse 2011年7月28日 7:05
    2011年7月28日 5:27

全部回复

  • I recommand you use Agent Task, but not ConsoleTask.

    The different is ConsoleTask running locally on Console machine.

    AgentTask will distribute to each machine where your task target instance running on.

     

    Than about your task failure, first, Task succeed execute the script, then script fails, this is nothing related SCOM, SCOM doesn't parse your task output and analyze it and think your task successfully executed.

    Task only failes when SCOM failed to start your script.

    Here is a solution not resolve your issues but does helps a little: use"Agent Task\Command Line" template, since CMD have StdOut and StdErr, and SCOM does parse CMD output and show them in different section, you know whether your script succeed or failed at one glance.


    Haitao Chen (haidaocht # gmail.com)
    • 已标记为答案 Eronse 2011年7月28日 7:05
    2011年7月28日 5:27
  • Another Point is you should ask SCOM related question in " IT管理 Operations 论坛\Operations Manager" .
    Haitao Chen (haidaocht # gmail.com)
    2011年7月28日 5:28
  • thanks a lot!!
    2011年7月28日 7:06