6、经过不懈的查找,发现了一个ps脚本,把下面脚本,存成一个ps1文件,执行一下,会起作用(至少我这里已经起作用了,会删掉多余的历史记录);
Add-PSSnapin Microsoft.SharePoint.PowerShell
Write-Host "Clearing Down Timer Job History"
$daysToKeep = 300
$daysToPurgeInOneLoop = 5
while ($daysToKeep -gt 0)
{
$history = get-sptimerjob | where-object {$_.name -eq “job-delete-job-history”}
Write-Host " "
Write-Host -NoNewLine "Setting Days to Keep:"
Write-Host -ForegroundColor Green $daysToKeep
$history.DaysToKeepHistory = $daysToKeep
$history.update()
Write-Host -ForegroundColor Green "Starting Purge Job"
$lastTimeJobRan = $history.LastRunTime
$history.runnow()
Write-Host -NoNewLine -ForegroundColor Green "Waiting For Purge Job to Complete"
$jobFinished = $false
while ($jobFinished -eq $false)
{
Start-Sleep -Seconds 2
$runningJob = Get-SPTimerJob $history.Name
Write-Host -NoNewLine -ForegroundColor Yellow "."
if ($lastTimeJobRan -ne $runningJob.LastRunTime)
{
$jobFinished = $true
}
}
Write-Host " "
Write-Host -ForegroundColor Green "Ending Purge Job"
$daysToKeep = $daysToKeep - $daysToPurgeInOneLoop
}
Write-Host -ForegroundColor Green "Setting Final Job History Retention to 3 days, and schedule to run daily @ 5am"
$history.DaysToKeepHistory = 3
$history.update()
$history.runnow()
Set-SPTimerJob -Identity $history -Schedule "Daily at 05:00"
Write-Host -ForegroundColor Yellow "Please check row counts on dbo.TimerJobHistory Table in Config DB to ensure run complete"
  结束语
  当然,执行PowerShell的命令需要很长时间,我这里用了大概1天时间,将90多个GB的SharePoint_Config收缩到了15个GB,效果还是很明显的,整理出来很大一部分空间,不用经常做磁盘空间维护了。