Maintenance mode rule creation

Microsoft.SystemCenter.RuleTemplates.MaintenanceMode (Template)

This rule template lets users create rules for scheduling objects in maintenance mode.

Source Code:

<Template ID="Microsoft.SystemCenter.RuleTemplates.MaintenanceMode" Purpose="RuleCreation">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element name="ID" type="xsd:string"/>
<xsd:element name="LocaleId" type="xsd:string"/>
<xsd:element name="StartTime" type="xsd:string"/>
<xsd:element name="Duration" type="xsd:unsignedInt"/>
<xsd:element name="DaysOfWeekMask" type="xsd:unsignedInt"/>
<xsd:element name="ComputerGroupID" type="xsd:string"/>
<xsd:element name="Reason" type="xsd:string"/>
<xsd:element name="Comments" type="xsd:string"/>
<xsd:element name="ComputerGroupName" type="xsd:string"/>
<xsd:element name="DaysOfWeek" type="xsd:string"/>
</Configuration>
<References>
<Reference ID="System"/>
<Reference ID="SC"/>
<Reference ID="Windows"/>
<Reference ID="Self"/>
<Reference ID="Health"/>
</References>
<Implementation>
<TypeDefinitions>
<ModuleTypes>
<DataSourceModuleType ID="MaintenanceMode.Scheduler" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StartTime" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DaysOfWeekMask" type="xsd:integer"/>
</Configuration>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.Scheduler">
<Scheduler>
<WeeklySchedule>
<Windows>
<Daily>
<Start>$Config/StartTime$</Start>
<End>23:59</End>
<DaysOfWeekMask>$Config/DaysOfWeekMask$</DaysOfWeekMask>
</Daily>
</Windows>
</WeeklySchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.TriggerData</OutputType>
</DataSourceModuleType>
<WriteActionModuleType ID="MaintenanceMode.WriteAction" Accessibility="Internal" RunAs="SC!Microsoft.SystemCenter.AgentManagementAccount" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComputerGroupID" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Duration" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Comments" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Reason" type="xsd:string"/>
</Configuration>
<ModuleImplementation>
<Managed>
<Assembly>Microsoft.SystemCenter.Essentials.ResKit.Modules, Culture="", PublicKeyToken="31bf3856ad364e35", Version="6.0.1250.0"</Assembly>
<Type>Microsoft.SystemCenter.Essentials.ResKit.Modules.MaintenanceModeWriteActionModule</Type>
</Managed>
</ModuleImplementation>
<InputType>System!System.TriggerData</InputType>
</WriteActionModuleType>
</ModuleTypes>
</TypeDefinitions>
<Monitoring>
<Rules>
<Rule ID="MaintenanceMode.Rule.$TemplateConfig/ID$" Enabled="true" Target="SC!Microsoft.SystemCenter.RootManagementServer" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>Custom</Category>
<DataSources>
<DataSource ID="Scheduler" TypeID="MaintenanceMode.Scheduler">
<StartTime>$TemplateConfig/StartTime$</StartTime>
<DaysOfWeekMask>$TemplateConfig/DaysOfWeekMask$</DaysOfWeekMask>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="MaintenanceModeWA" TypeID="MaintenanceMode.WriteAction">
<ComputerGroupID>$TemplateConfig/ComputerGroupID$</ComputerGroupID>
<Duration>$TemplateConfig/Duration$</Duration>
<Comments>$TemplateConfig/Comments$</Comments>
<Reason>$TemplateConfig/Reason$</Reason>
</WriteAction>
</WriteActions>
</Rule>
</Rules>
</Monitoring>
<LanguagePacks>
<LanguagePack ID="$TemplateConfig/LocaleId$" IsDefault="true">
<DisplayStrings>
<DisplayString ElementID="MaintenanceMode.Rule.$TemplateConfig/ID$">
<Name>Maintenance mode rule for $TemplateConfig/ComputerGroupName$, every $TemplateConfig/DaysOfWeek$ at $TemplateConfig/StartTime$ for $TemplateConfig/Duration$ minutes.</Name>
<Description>
Computer group: $TemplateConfig/ComputerGroupName$;
Start Time: $TemplateConfig/StartTime$;
Days of week: $TemplateConfig/DaysOfWeek$;
Duration: $TemplateConfig/Duration$ minutes;
Reason: $TemplateConfig/Reason$;
Comments: $TemplateConfig/Comments$
</Description>
</DisplayString>
<DisplayString ElementID="MaintenanceMode.Scheduler">
<Name>Maintenance Mode Scheduler</Name>
<Description>Scheduler used to put one or more computers in maintenance mode</Description>
</DisplayString>
<DisplayString ElementID="MaintenanceMode.WriteAction">
<Name>Maintenance Mode Write Action Module</Name>
<Description>Write action module to put one or more computers in maintenance mode, takes in group GUID, duration, reason and comments as parameters</Description>
</DisplayString>
</DisplayStrings>
</LanguagePack>
</LanguagePacks>
</Implementation>
</Template>