May
11

Custom console tasks: Part 1

By

In Service Manager 2010 there is a concept of console tasks. Using tasks you’re able to quickly perform actions while working in the console. An example of this could be launching remote desktop against a computer affected by an incident by just pressing a link within the incident form.

Console tasks are a great feature of Service Manager, but what’s even greater is that you can create your own. There are two different ways to add console tasks, in the console “Library – Tasks” or by defining console tasks in a management pack and importing this. The difference between these two entry points is that you can add much more advanced tasks in the latter one. In this first post of two I’m going to show you how to add a task directly in the console. To show you how to do this – here is how to add a task for rebooting the affected computer of an incident.

  1. Go to LibraryTasksNew Task
  2. Name the task “Reboot affected computer
  3. Choose the target class Incident
    (This associates the task with the incident form and enables us to use properties and related objects properties of the selected incident as arguments for the task command line)
  4. Choose the Incident management Folder Tasks category
    (This controls where the task will be available in the console)
  5. Full path to command: shutdown.exe
  6. On the Parameters section, click insert property and choose: IncidentAbout Config Item
    (“About Config Items” is called “Affected Items” in the form)
  7. Select the property called “NetBIOS Computer Name”
    (Locate it faster by using the search functionality)
  8. Working directory: “%windir%\system32” 
  9. Check: Log in action log when this task is run
  10. Check: Show output when this task is run

Note: You cannot use the option to “log in action log when this task is run”, without using the “show output when this task is run”. Doing so will cause the action to not get registered in the action log. This is a reported bug (not confirmed)!


Now you’ve created a task that can be used from the Incident Management part of the console to reboot an affected computer of an incident.

Some important things to remember here:

  • If the list of “Affected Items” (About Config Item) only contains one computer the task will be executed without prompting the user. In this case this would mean that, clicking the reboot task would instantly reboot the affected computer without asking questions like “Are you sure….?”. In the case of the list containing more than one computer, the user will get prompted to select which of the listed computer to reboot.
  • The file specified in the command, in this case shutdown.exe, needs to be available on each machine where the console will be used to launch the task (in this specific case this shouldn’t be a problem since shutdown.exe is distributed with the OS).
  • When executing a console task, the task will be executed in the context of the logged on user. You can still use roles in Service Manager to show/hide console tasks from different users, but remember that seeing a console task doesn’t automatically give a user the permission to execute the task successfully.

Related information: http://blogs.technet.com/servicemanager/archive/2010/02/11/tasks-part-1-tasks-overview.aspx

In the next part of “Custom console tasks” series I’ll show how to add more advanced console tasks using the SDK (some coding coming up!) and a custom management pack.

Leave a Reply