Thursday, December 13, 2007

SCOM 2007 SP1 - Parameters not working with custom tasks

Scenario: I wanted to create a task to allow a remote console (cmd line) to target machines. I have seen this done several times in MOM2005 using PSExec (http://www.it-jedi.net/HOW-TO/HOW-TO-Remote_Interactive_CmdPrompt.doc) so it should be a simple matter of translating this to the new formats.

I created a new Console Tasks Command line,
- Name: Remote Console
- Task target: Agent
- Application: \\wtmsscom1\scripts\psexec.exe
- Parameters: \\$Target/Property[Type= SystemLibrary6050000!System.Entity ]/DisplayName$ cmd
- Working Directory: \\wtmsscom1\scripts

When I execute the task I get the following:
----------------------------------------------------------
PsExec v1.43 - execute processes remotely
Copyright (C) 2001-2003 Mark Russinovich
www.sysinternals.com

Connecting to $Target/Property[Type=...
The network path was not found.

Couldn't access $Target/Property[Type=:
Make sure that the default admin$ share is enabled on $Target/Property[Type=.

----------------------------------------------------------

For some reason, the parameter is not being substituted by SCOM properly. I validated there were now typo's or other errors, but nothing seemed to work. As a last resort I exported the MP and viewed the XML -- bingo!

\\wtmsscom1\scripts\psexec.exe

\\$Target/Host/Property[Type=
SystemLibrary6050000!System.Entity
]/DisplayName$
cmd

\\wtmsscom1\scripts\


Somehow the parameter is being parsed into 3 separate parameters, a bit of editing and I come up with the following which imports and executes properly:

\\wtmsscom1\scripts\psexec.exe

\\$Target/Host/Property[Type="SystemLibrary6050000!System.Entity"]/DisplayName$
cmd

\\wtmsscom1\scripts\



Was I missing something here? Is this a bug in SP1?

***************************************************************
Update (12/18) it looks like somehow the attribute is being misinterpreted by SCOM and the quotes are the cause. Below is the line I entered, but after it is the line that SCOM sees, with the quotes replaced as spaces:
  • $Target/Host/Property[Type="SystemLibrary6050000!System.Entity"]/DisplayName$
  • $Target/Host/Property[Type= SystemLibrary6050000!System.Entity ]/DisplayName$
If the SCOM console misinterprets the quotes as spaces, then it makes sense that the task wouldnt run properly. Hopefully this will be fixed prior to RTM or there will be a lot of mistakes make in my custom tasks.

1 comment:

Pete Zerger said...

Ed, it failed for me on Opsmgr 2007 for different reasons. I got Opsmgr to do the string replacement, but it keeps putting a space between the \\ and the computer name, causing a failure....so still no help.

That MOM 2005 version took me only 10 minutes to figure out. Wish it were still that easy.