locked
Passing Parameters to a PS script through modules RRS feed

  • Question

  • Hi,

    I have a MP which consists a rule and the rule contains EventProvider DS and and PowerShell Write Action module. This Write action module will get the endpoint status and write it to the log. right now i am hard coding the endpoint address in the script itself. can any one tell me how to pass this endpoint as a parameter instead of hardcoding it in the PS script?

    Tuesday, November 22, 2011 5:45 AM

All replies

  • <WriteAction ID="PSWriteAction" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
              <ScriptName>EndpointStatus.ps1</ScriptName>
              <ScriptBody>
                 param($EndpointName)
                 write-host $EndpointName
              </ScriptBody>
              <Parameters>
                <Parameter>
                  <Name>EndpointName</Name>
                  <Value>$Config/Parameter1$</Value>
                </Parameter>
              </Parameters>
              <TimeoutSeconds>300</TimeoutSeconds>
            </WriteAction>
    

    add Parameter1 into configuration of the rule when authoring 
    Tuesday, November 22, 2011 1:51 PM
  • Hi Pavel,

    Thanks for the reply and i am very sorry to say this , i am not able to understand as i am just beginner in SCOM

    Can you give some more details on this ?

    Wednesday, November 23, 2011 6:41 AM
  •  Hi,

    there are 4 types of parameters variables in Scom help to develop new monitoring types and composite modules.

    1) Config :http://blogs.msdn.com/b/mariussutara/archive/2007/11/15/parameter-replacements-part-1.aspx

    2) $MPElement$: http://blogs.msdn.com/b/mariussutara/archive/2007/11/16/parameter-replacements-part-2.aspx

    3)Target :http://blogs.msdn.com/b/mariussutara/archive/2007/11/17/parameter-replacements-part-3.aspx

    4) Data :http://blogs.msdn.com/b/mariussutara/archive/2007/11/20/parameter-replacements-part-4.aspx

     
    Regards


    sridhar v

    Monday, April 15, 2013 1:44 AM