This article shows how to get the timer job status and histories using PowerShell scripts.
IntroductionThis article shows how to get the timer job status and histories using PowerShell scripts.Timer Jobs:A timer job contains a definition of the service to run and specifies how frequently the service is started. The SharePoint 2010 Timer service (SPTimerv4) runs timer jobs. Many features in SharePoint rely on timer jobs to run services according to a schedule.Timer job reports:Now I will show you how to export the timer job report into a CSV file. Look at the following code that gets you the information:
When the preceding function is called you get an output in a CSV file (TimerJobReport.csv) that has the preceding stated information on all the timer jobs in your SharePoint Farm.Timer job Latest historyNow I will show you how to get the latest (last run) history for all the timer jobs in the SharePoint farm. The following code gets you the following information for all the timer jobs in the SharePoint Farm and outputs it to a CSV file (TimerJobHistoryReport.csv).
In the preceding function you need to match the last run time with the job history start time to get the latest history for the timer job.Specific Timer job historyNow I will show you how to get history for a specific timer job and how many latest histories that you want to look at. The following script generates a report for a given specific timer job and it is input from the user to show how much history data they would need to generate the given timer job. The following code helps to do that and exports the output to a CSV file (SpecificTimerJobHistoryReport.csv).
The preceding function requires input from the user on the following 2 things:
Complete codePlease find the following complete code for getting the various reports on timer jobs.
Execution procedureStep 1: Copy the script to the execution folder.Step 2: Launch the SharePoint Management Shell.Step 3: Navigate to the execution folder path.Step 4: Execute the TimerJobReport.ps1 file.Enter “1” to get the generic timer job reports. Option “1” captures the following information:
Once the script completes you get the outputs in 2 CSV files. One (TimerJobReport.csv) for the generic timer job report and another (TimerJobHistoryReport.csv) for the latest history for all the timer jobs in the SP Farm.The output looks as in the following:
Enter “2” to get specific timer job report.Enter the timer job name for which you want to list the latest number of histories.You get the output in a CSV file (SpecificTimerJobHistoryReport.csv) that is located under the location where the .ps1 file is placed. The output CSV file has the following details.ConclusionThus this article outlined how to get the timer job reports in a SharePoint 2010 Farm.
SharePoint Designer 2010 Essentials