当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 使用 PowerShell 按需强制运行 SharePoint 运行状况分析器作业

作者:精品下载站 日期:2024-12-14 13:42:27 浏览:12 分类:玩电脑

使用 PowerShell 按需强制运行 SharePoint 运行状况分析器作业


我们可能希望按需运行 SharePoint 运行状况分析器来检查场上的一切是否正常,而不是等待它们自动运行。那么,正如另一篇文章“使用 PowerShell 按需运行 SharePoint 2010 计时器作业”中所讨论的,我们可以使用 PowerShell 强制运行按需运行 SharePoint 运行状况分析器计时器作业!

如何使用 PowerShell 运行 SharePoint 2013 运行状况分析器

让我们使用 PowerShell 强制运行运行状况分析器作业。这是重新运行健康分析器的 PowerShell


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 
#Display name of the Timer Job to Run on-demand
$TimerJobName = "Health Analysis Job"
 
#Get the Timer Job
$TimerJobs = Get-SPTimerJob | where { $_.DisplayName -match $TimerJobName}

foreach($TimerJob in $TimerJobs) 
{
    Write-Host "Running:" $TimerJob.DisplayName
    $TimerJob.RunNow()
}

该脚本执行显示名称中带有“健康分析作业”的所有计时器作业,立即执行健康检查!

[玩转系统] 使用 PowerShell 按需强制运行 SharePoint 运行状况分析器作业

One Liner to SharePoint 2013 运行所有运行状况分析器:


Get-SPTimerJob | where { $_.DisplayName -match "Health Analysis Job"} | % { Start-SPTimerJob $_ ; Write-Host "Runing Job:" $_.displayName }

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯