Once again, a little post to share with you guys about Operations Manager Tasks – this time using Powershell. First a little background story: Current version of Operations Manager 2007 (SP1RC) has still some nasty bugs and it seems that especially the events view doesn’t get much attention from the product team.
The event view doesn’t HTML-Encode the event description in the details pane. Which is bad if you have to look at events (published exceptions for example) with fragments of XML or HTML included. This information just doesn’t appear in the preview pane.
So, the first thing which came to my mind is: Ok, then. How about some kind of console task which executes a quick Powershell command to dump out the event details using the Get-Event Cmd-Let.
Next Problem: You can create an event task and put a dynamic parameter $ID$ in it. However, starting the task using the actions pane on the right always passes the same ID (I guess the ID from the first event selected when the view gets loaded) to the task – regardless which event was selected!
Lucky me, there is a workaround: When you execute the task using the Actions menu in the console, the task will always get the ID from the selected event.
So, now the interesting stuff: How to setup such a task?
- First create a console task for events using the authoring section in the console.
- When defining the command, set the application to:C:WINDOWSsystem32windowspowershellv1.0powershell.exe
- Set the parameter to: -PSConsoleFile Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1 -NoExit .Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.ps1;Get-Event -Id $ID$
- Set the working directory to: C:Program FilesSystem Center Operations Manager 2007
- Finally, uncheck the “Display output when the task is run” checkbox
That’s it. Enjoy…
CEO of code4ward GmbH and Windows lead developer at http://www.royalapps.com where most of the time is spent on Royal TS, a multi platform, multi protocol remote management solution, for Windows, macOS and mobile supporting RDP, VNC, SSH, Telnet, and many more.
Long time Microsoft MVP supporting communities on- and offline as well as speaking at user groups and conferences about DevOps and other software development topics.