對於企業維護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設置。
感謝閱讀。