啟動 SQL Agent 服務

Microsoft.SQLServer.2008.StartSQLAgentFromJob (Task)

啟動 SQL Agent 服務。
請注意,所有版本的 SQL Server Express 都不支援 SQL Server Agent Windows 服務。

Element properties:

TargetMicrosoft.SQLServer.2008.AgentJob
AccessibilityInternal
CategoryMaintenance
EnabledTrue
RemotableFalse
Timeout300

Member Modules:

ID Module Type TypeId RunAs 
WA WriteAction System.CommandExecuter Microsoft.SQLServer.SQLDefaultAccount

Source Code:

<Task ID="Microsoft.SQLServer.2008.StartSQLAgentFromJob" Target="SQL2008Core!Microsoft.SQLServer.2008.AgentJob" Accessibility="Internal" Enabled="true" Remotable="false">
<Category>Maintenance</Category>
<WriteAction ID="WA" TypeID="System!System.CommandExecuter" RunAs="SQL!Microsoft.SQLServer.SQLDefaultAccount">
<ApplicationName/>
<WorkingDirectory/>
<CommandLine>net start $Target/Host/Property[Type="SQL!Microsoft.SQLServer.Agent"]/ServiceName$</CommandLine>
<TimeoutSeconds>300</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files/>
</WriteAction>
</Task>