Run a PowerShell script (Community)

Community.PowerShellMonitoring.Template.PowerShellTask.AgentTask (Template)

This task runs a PowerShell script on the agent or the management server computer.

Source Code:

<Template ID="Community.PowerShellMonitoring.Template.PowerShellTask.AgentTask" Purpose="TaskCreation">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ID" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Name" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Description" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Target" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Category" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="LocaleId" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ScriptName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Arguments" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ScriptBody" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<References>
<Reference ID="Self"/>
</References>
<Implementation>
<Monitoring>
<Tasks>
<Task ID="$TemplateConfig/ID$" Target="$TemplateConfig/Target$" Accessibility="Public">
<Category>$TemplateConfig/Category$</Category>
<WriteAction ID="PA" TypeID="$Reference/Self$Community.PowerShellMonitoring.WriteAction.SimplePowerShellScript">
<ScriptName>$TemplateConfig/ScriptName$</ScriptName>
<Arguments>$TemplateConfig/Arguments$</Arguments>
<ScriptBody><Script>$TemplateConfig/ScriptBody$</Script></ScriptBody>
<TimeoutSeconds>$TemplateConfig/TimeoutSeconds$</TimeoutSeconds>
</WriteAction>
</Task>
</Tasks>
</Monitoring>
<LanguagePacks>
<LanguagePack ID="$TemplateConfig/LocaleId$" IsDefault="true">
<DisplayStrings>
<DisplayString ElementID="$TemplateConfig/ID$">
<Name>$TemplateConfig/Name$</Name>
<Description>$TemplateConfig/Description$</Description>
</DisplayString>
</DisplayStrings>
</LanguagePack>
</LanguagePacks>
</Implementation>
</Template>