Habilitar y deshabilitar trabajos del temporizador usando PowerShell en SharePoint
Los trabajos de temporizador realizan tareas específicas en SharePoint a través del servicio de temporizador de Windows, como enviar alertas por correo electrónico a una hora programada. En el sitio de Administración central de SharePoint, puede verificar los trabajos del temporizador, deshabilitar o habilitar trabajos del temporizador específicos.
Script de PowerShell para comprobar el estado del trabajo del temporizador:
#Function to Check Timer job status
Function Get-TimerJobStatus($TimerJobName)
{
$TimerJob = Get-SPTimerJob | Where-Object { $_.displayname -like $TimerJobName }
if($TimerJob -eq $null)
{
Write-host "Timer job not found!" -ForegroundColor Red
return
}
$TimerJobDisabled = $TimerJob | Select -ExpandProperty IsDisabled
if($TimerJobDisabled)
{
Write-host "Timer Job is Disabled!" -ForegroundColor Yellow
}
else
{
Write-host "Timer Job is Enabled!" -ForegroundColor Green
}
}
$TimerJobName="My Site Cleanup Job"
Get-TimerJobStatus $TimerJobName
¿Cómo deshabilitar un trabajo del temporizador en SharePoint?
Para deshabilitar un trabajo del temporizador, diríjase a Administración central >> Monitoreo >> Trabajos del temporizador >> Revise las definiciones de trabajo >> elija su objetivo de la lista de trabajos del temporizador en SharePoint 2013 >> Haga clic en el botón "Desactivar" para deshabilitar un temporizador trabajo.
Deshabilitar el trabajo del temporizador de SharePoint mediante PowerShell
Aquí está el PowerShell para deshabilitar un trabajo del temporizador en SharePoint:
#Function to Disable a Timer job
Function Disable-TimerJob($TimerJobName)
{
$TimerJob = Get-SPTimerJob | Where-Object { $_.displayname -like $TimerJobName }
if($TimerJob -eq $null)
{
Write-host "Timer job not found!" -ForegroundColor Red
return
}
$TimerJobDisabled = $TimerJob | Select -ExpandProperty IsDisabled
if($TimerJobDisabled)
{
Write-host "Timer Job is already Disabled!" -ForegroundColor Yellow
}
else
{
$TimerJob | Disable-SPTimerJob
Write-host "Timer Job Disabled!" -ForegroundColor Green
}
}
#Timer job name to disable
$TimerJobName="My Site Cleanup Job"
#Call the function to Disable Timer job
Disable-TimerJob $TimerJobName
Activar trabajo del temporizador en SharePoint:
Para activar un trabajo con temporizador deshabilitado, vaya a:
- Administración central >> Monitoreo >> Trabajos del temporizador
- Revise las definiciones de trabajos >> elija su objetivo de la lista de trabajos del temporizador en SharePoint 2013
- Haga clic en el botón "Habilitar" para activar el trabajo del temporizador.
Esto habilita el trabajo del temporizador deshabilitado en SharePoint 2013.
Habilite el trabajo del temporizador de SharePoint con PowerShell:
#Function to Enable a Timer job
Function Enable-TimerJob($TimerJobName)
{
$TimerJob = Get-SPTimerJob | Where-Object { $_.displayname -like $TimerJobName }
if($TimerJob -eq $null)
{
Write-host "Timer job not found!" -ForegroundColor Red
return
}
$TimerJobDisabled = $TimerJob | Select -ExpandProperty IsDisabled
if($TimerJobDisabled)
{
$TimerJob | Enable-SPTimerJob
Write-host "Timer Job Enabled!" -ForegroundColor Green
}
else
{
Write-host "Timer Job is Already Enabled!" -ForegroundColor Yellow
}
}
#Timer job name to Enable
$TimerJobName="My Site Cleanup Job"
#Call the function to Enable Timer job
Enable-TimerJob $TimerJobName
Esto activa el trabajo del temporizador en SharePoint 2010 con PowerShell.

