Syspolicy_purge_history job in SQL Server

Policy Management is a new feature introduced on SQL Server 2008. Every time a policy runs it stores the results in MSDB. The default job called syspolicy_purge_history deletes the data older than the number of days defined in HistoryRetentionInDays property of Policy Management, so it doesn't take up space in MSDB system database unnecessarily.

You can see the value of HistoryRetentionInDays parameter in SQL Server Management Studio by right clicking Policy Management, and choosing Properties:

By default the value of 'HistoryRetentionInDays' parameter is 0 which means that the history will not be automatically removed.
'Enabled' parameter determines whether Policy-Based Management is enabled.
'LogOnSuccess' parameter specifies whether Policy-Based Management logs successful policy evaluations.

You can change the parameter value and click OK.

Another way to see the value of HistoryRetentionInDays parameter is to run the following query:

SELECT current_value
FROM msdb.dbo.syspolicy_configuration
WHERE name = N'HistoryRetentionInDays';

You can change the value of HistoryRetentionInDays parameter to 10 days using the following query:

EXEC msdb.dbo.sp_syspolicy_set_config_history_retention @value = 10;
GO

The job runs the following query to remove the policy evaluation history (you can run it manually when needed):

EXEC msdb.dbo.sp_syspolicy_purge_history;
GO

To re-create the syspolicy_purge_history job, run the following Transact-SQL statement:
http://support.microsoft.com/kb/955726

DECLARE @jobId uniqueidentifier
-- Obtain the current job identifier that is associated with the PurgeHistory
SELECT @jobId = CAST(current_value AS uniqueidentifier)
FROM msdb.dbo.syspolicy_configuration_internal
WHERE name = N'PurgeHistoryJobGuid'
-- Delete the job identifier association in the syspolicy configuration
DELETE FROM msdb.dbo.syspolicy_configuration_internal
WHERE name = N'PurgeHistoryJobGuid'
-- Delete the offending job
EXEC msdb.dbo.sp_delete_job @job_id = @jobId
-- Re-create the job and its association in the syspolicy configuration table
EXEC msdb.dbo.sp_syspolicy_create_purge_job