locked
Target a task won't work? RRS feed

  • Question

  • I'm trying to do something easy like this:
    Create a new task that starts a windows service. This task should be
    activated manually, and it should only run on one specific server.

    However, it seems this is impossible to make in SCOM!
    It is possible to target this task to all windows servers. No problem. But
    targeting the task at one server simply doesn't work.

    What I've done:
    Create a new MP named TEST-MP
    Create a new Group named TEST-GROUP
    Add one server to this group
    Create a new task named TEST-TASK
    Target this task at TEST-GROUP using the TEST-MP management pack.

    Now, when you select the server that is in the group, you won't find the
    newly created task. If you repeat these steps, and target the task to
    'Windows Server' then you will see the task on all servers, but that is not
    what I want.

    Any help with this?

    Monday, June 22, 2009 7:41 AM

Answers

  • Thanks for your answer.
    This makes it a bit more complicated as I'm not familair with creating classes.

    • Proposed as answer by Saviola Lulu Tuesday, June 23, 2009 2:49 AM
    • Marked as answer by StuartR Thursday, August 27, 2009 7:02 PM
    Monday, June 22, 2009 12:52 PM

All replies

  • Hi,
     
    You can not use a group as a target, you need to use a class. You can extend a class or you can create a new class and discovery in the authoring console

    --

    Anders Bengtsson
    Microsoft MVP - Ops Mgr
    www.contoso.se
    Monday, June 22, 2009 9:26 AM
  • Thanks for your answer.
    This makes it a bit more complicated as I'm not familair with creating classes.

    • Proposed as answer by Saviola Lulu Tuesday, June 23, 2009 2:49 AM
    • Marked as answer by StuartR Thursday, August 27, 2009 7:02 PM
    Monday, June 22, 2009 12:52 PM
  • This site http://www.authormps.com/dnn/ has some good guides and examples how to create a basic management pack in the authoring console, that will discovery something at your servers and create a new class.

    --

    Anders Bengtsson
    Microsoft MVP - Ops Mgr
    www.contoso.se
    • Proposed as answer by S. Halsey Monday, June 22, 2009 5:52 PM
    Monday, June 22, 2009 2:13 PM
  • You could also target your task at an existing class, like Windows Computer or Windows 2008 Operating System.   The task will only run when you request it from the console.  Just remember it will be available on all computers that have that class, and an Operator has permissions to run the task.  Here is an example of a Task to start the MSExchangeADTopology service on an Exchange Unified Messaging Server.  Note this task makes use of a RunAs Profile to elevate permissions on the server.

          <Task ID="Microsoft.Exchange2007.UM.Task.MSExchangeADTopology.Start" Accessibility="Internal" Enabled="true" Target="ExLibrary!Microsoft.Exchange2007.ServerRole.UM" Timeout="300" Remotable="false">
            <Category>Maintenance</Category>
            <WriteAction ID="WA" RunAs="ExLibrary!Microsoft.Exchange2007.Account.Administrator" TypeID="System!System.CommandExecuter">
              <ApplicationName><![CDATA[%SystemRoot%\System32\net.exe]]></ApplicationName>
              <WorkingDirectory><![CDATA[%SYSTEMROOT%\temp]]></WorkingDirectory>
              <CommandLine>start MSExchangeADTopology</CommandLine>
              <TimeoutSeconds>60</TimeoutSeconds>
              <RequireOutput>true</RequireOutput>
              <Files />
            </WriteAction>
          </Task>
    • Proposed as answer by S. Halsey Monday, June 22, 2009 5:52 PM
    Monday, June 22, 2009 4:49 PM
  • That's how I currently do it, but not the preferred way.

    To explain the problem a bit more:

    We have an operator that maintains an application. This application runs on SERVER1, SERVER2 and SERVER3.
    On server1 he should be able to restart the complete server. On server 2 and 3 he should be able to restart a service x.

    Because we don't want to give him admin rights on our windows servers, we thought this would be the perfect job for SCOM.

    I created  an 'advanced operator' role which can perform those tasks as well as view computers and tasks. Because the tasks are targetted at the existing class 'Windows Computer' the operator can execute all tasks on all three servers. So he might be able to restart all 3 servers.
    It would be great if there was an easy way to target the task at specific servers (or groups).
    Tuesday, June 23, 2009 10:51 AM
  • Then the simplest thing to do is probably:
     - Create a Custom class to represent your application
     - Create a discovery for the class, target it at Windows.Computer or Windows.Server.  Have this class be disabled by default, this way you don't have to create any logic about what constitutes your application (no need to figure out registry keys or some such). 
     - create your task and target the task at this custom class
     - Enable the discovery of the custom class only on your three computers
     - Give your users Operator rights in the scope of the custom class.  Operator has enough permissions to run tasks.
    Tuesday, June 23, 2009 6:34 PM