对于企业维护SharePoint环境过程中,可能会遇到计划在SharePoint Farm的server中开启Timer Service Instance的情况,来实现在server中设置Schedule timer job。
那么如何在server中enable timer service instance呢?
可以通过执行下面script实现:
1. 使用administrator打开Windows Powershell;
2. 执行下面Script;
Add-PSSnapin Microsoft.SharePoint.PowerShell
$farm = Get-SPFarm
$disabledTimers = $farm.TimerService.Instances | where {$_.Status -ne "Online"}
if ($disabledTimers -ne $null)
{
foreach ($timer in $disabledTimers)
{
Write-Host "Timer service instance on server " $timer.Server.Name " is not Online. Current status:" $timer.Status
Write-Host "Attempting to set the status of the service instance to online"
$timer.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online
$timer.Update()
}
}
else
{
Write-Host "All Timer Service Instances in the farm are online! No problems found"
}
3. Timer services instance启动成功,可以进行后续timer job设置。
感谢阅读。