Restart Health Service Write Action

Microsoft.SystemCenter.AgentManagement.RestartService (WriteActionModuleType)

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
InputTypeSystem.BaseData
OutputTypeSystem.CommandOutput

Member Modules:

ID Module Type TypeId RunAs 
StartService WriteAction System.CommandExecuter Default
StopService WriteAction System.CommandExecuter Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
ComputerNamestring$Config/ComputerName$Computer Name
ServiceNamestring$Config/ServiceName$Service Name

Source Code:

<WriteActionModuleType ID="Microsoft.SystemCenter.AgentManagement.RestartService" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element name="ComputerName" type="xsd:string"/>
<xsd:element name="ServiceName" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="ComputerName" Selector="$Config/ComputerName$" ParameterType="string"/>
<OverrideableParameter ID="ServiceName" Selector="$Config/ServiceName$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="StopService" TypeID="System!System.CommandExecuter">
<ApplicationName>%WinDir%\System32\sc.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>\\$Config/ComputerName$ stop $Config/ServiceName$</CommandLine>
<TimeoutSeconds>60</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
</WriteAction>
<WriteAction ID="StartService" TypeID="System!System.CommandExecuter">
<ApplicationName>%WinDir%\System32\sc.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>\\$Config/ComputerName$ start $Config/ServiceName$</CommandLine>
<TimeoutSeconds>60</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="StartService">
<Node ID="StopService"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.CommandOutput</OutputType>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>