{"id":7687,"date":"2016-04-26T14:38:47","date_gmt":"2016-04-26T12:38:47","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/"},"modified":"2016-04-26T14:38:47","modified_gmt":"2016-04-26T12:38:47","slug":"syspolicy_purge_history-job-and-powershell-executionpolicy","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/","title":{"rendered":"syspolicy_purge_history job and PowerShell ExecutionPolicy"},"content":{"rendered":"<p>Since SQL Server 2008, Microsoft has introduced a system job called \u201csyspolicy_purge_history\u201d. This job is installed and enabled by default, and it contains three steps scheduled at 02:00 AM:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-8291 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history.png\" alt=\"syspolicy_purge_history\" width=\"223\" height=\"152\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_steps1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8293\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_steps1.png\" alt=\"syspolicy_purge_history_steps\" width=\"699\" height=\"196\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_schedules.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8296\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_schedules.png\" alt=\"syspolicy_purge_history_schedules\" width=\"660\" height=\"144\" \/><\/a><\/p>\n<p>What is this job? And what is it for?<\/p>\n<p>Since SQL Server 2008, a new feature called <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/bb510667.aspx\">Policy Based Management<\/a> has been added. When your policies are run, the results are stored in the msdb. But without a purge mechanism, msdb will keep growing. So Microsoft introduced the famous system job named \u201csyspolicy_purge_history\u201d to clean the results older than the days defined in the \u201cHistoryRetentionInDays\u201d property of Policy Management.<\/p>\n<p>&nbsp;<\/p>\n<p>Should I disable it?<\/p>\n<p>Definitively not. This job is part the well-functioning of SQL Server.<\/p>\n<p>&nbsp;<\/p>\n<p>Should I care about it?<\/p>\n<p>We do recommend to monitor this job as all other dba jobs.<\/p>\n<p>&nbsp;<\/p>\n<p>But last time, this system job failed after each automatic and\/or manual executions&#8230;<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_execution_failed.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8297\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_execution_failed.png\" alt=\"syspolicy_purge_history_execution_failed\" width=\"589\" height=\"264\" \/><\/a><\/p>\n<p>If you go in details, you notice the third steps failed at the following line: \u201cset \u2013executionpolicy RemoteSigned \u2013scope process \u2013Force\u201d<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_detailed.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8298\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_detailed.png\" alt=\"syspolicy_purge_history_detailed\" width=\"1146\" height=\"358\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Apparently, the SQL Server engine was not able to modify the execution policy to \u201cRemoteSigned\u201d. Does the engine have enough permissions? Should I modify manually the execution policy as Administrator?<\/p>\n<p>Let\u2019s see the current \u201cExecutionPolicy\u201d configuration for the SQL Server PowerShell. Open the console from SQL Server Management Studio:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8299\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell.png\" alt=\"sql_server_powershell\" width=\"325\" height=\"411\" \/><\/a><\/p>\n<p>And you have a beautiful error to begin softly:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_error.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8300\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_error.png\" alt=\"sql_server_powershell_error\" width=\"670\" height=\"198\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>PowerShell executed the same command as previously, but with the same success\u2026<\/p>\n<p>Hopefully we have more details: Windows PowerShell tried to change the \u201cExecutionPolicy\u201d parameter, but a policy have overridden the change\u2026<\/p>\n<p>&nbsp;<\/p>\n<p>Let\u2019s see the \u201cExecutionPolicy\u201d depending on the different scopes:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_executionpolicy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8301\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_executionpolicy.png\" alt=\"sql_server_powershell_executionpolicy\" width=\"674\" height=\"182\" \/><\/a><\/p>\n<p>The \u201cExecutionPolicy\u201d at the \u201cMachinePolicy\u201d scope is set to \u201cAllSigned\u201d (which is more restrictive), and may override the configuration at the \u201cProcess\u201d scope. By setting the \u201cExecutionPolicy\u201d to \u201cRemoteSigned\u201d at the \u201cMachinePolicy\u201d scope, the problem may be resolved\u2026<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_modify_executionpolicy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8302\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_modify_executionpolicy.png\" alt=\"sql_server_powershell_modify_executionpolicy\" width=\"669\" height=\"151\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u2026or not! We cannot change manually the setting, even if the console is opened as Administrator!<\/p>\n<p>But as you can see, we have more details: we cannot change the \u201cExecutionPolicy\u201d this way, but we must change it through Group Policy.<\/p>\n<p>Let\u2019s open Local Group Policy Editor, and let\u2019s browse to \u201cLocal Computer Policy\\Computer Configuration\\Administrative Templates\\Windows Components\\Windows PowerShell\u201d.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Group_Policy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8303\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Group_Policy.png\" alt=\"Group_Policy\" width=\"1150\" height=\"730\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>But no policy is configured\u2026<\/p>\n<p>&nbsp;<\/p>\n<p>If I cannot change the \u201cExecutionPolicy\u201d at the \u201cMachinePolicy\u201d scope through the SQL Server PowerShell console, I propose you to change it directly in the registry \ud83d\ude09<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_executionpolicy_registry.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8304\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_executionpolicy_registry.png\" alt=\"sql_server_powershell_executionpolicy_registry\" width=\"1121\" height=\"1001\" \/><\/a><\/p>\n<p>\u2026the policy is correctly set to \u201cRemoteSigned\u201d, but this value is overridden from somewhere else\u2026 which is apparently not locally because I found no GPO configured\u2026 Someone must have set a GPO for the \u201cExecutionPolicy\u201d on the Domain Controller\u2026<\/p>\n<p>&nbsp;<\/p>\n<p>And indeed, there is a GPO which affects all the servers of the organization:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/GPO_AD.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8305\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/GPO_AD.png\" alt=\"GPO_AD\" width=\"1218\" height=\"264\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>For this resolution, Microsoft proposes two workarounds in the <a href=\"https:\/\/support.microsoft.com\/en-us\/kb\/2995870\">KB2995870<\/a>:<\/p>\n<ul>\n<li>Create a New Organization Unit for this server\u2026<\/li>\n<li>Or simply disable this GPO\u2026<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>To be honest, the domain administrator does not want to create a New Organization Unit for only one server. But he also does not want to disable this GPO for all the servers of the Organization.<\/p>\n<p>&nbsp;<\/p>\n<p>Hopefully, it does not mean we are stuck \ud83d\ude09 Even if the Active Directory is able to redefine the Policy on all the servers in an Organization, the local computer can always have the last word!<\/p>\n<p>I force the configuration of the \u201cExecutionPolicy\u201d policy directly in the local registry where SQL Server is installed:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/executionpolicy_local_policy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8308\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/executionpolicy_local_policy.png\" alt=\"executionpolicy_local_policy\" width=\"800\" height=\"999\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>And the miracle happens:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_executionpolicy2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8309\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/sql_server_powershell_executionpolicy2.png\" alt=\"sql_server_powershell_executionpolicy2\" width=\"533\" height=\"182\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_execution_success.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8310\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history_execution_success.png\" alt=\"syspolicy_purge_history_execution_success\" width=\"394\" height=\"249\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>To conclude, I will simply and shortly say: Registry is my best friend \ud83d\ude09<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since SQL Server 2008, Microsoft has introduced a system job called \u201csyspolicy_purge_history\u201d. This job is installed and enabled by default, and it contains three steps scheduled at 02:00 AM: &nbsp; What is this job? And what is it for? Since SQL Server 2008, a new feature called Policy Based Management has been added. When your [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":7703,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[272,51,54,52],"type_dbi":[],"class_list":["post-7687","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring","tag-powershell","tag-sql-server","tag-sql-server-2012","tag-sql-server-2014"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>syspolicy_purge_history job and PowerShell ExecutionPolicy - dbi Blog<\/title>\n<meta name=\"description\" content=\"syspolicy_purge_history may fail under SQL Server 2012 and SQL Server 2014 due to incorrect PowerShell ExecutionPolicy. But it can be easily fixed by modifying the registry.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"syspolicy_purge_history job and PowerShell ExecutionPolicy\" \/>\n<meta property=\"og:description\" content=\"syspolicy_purge_history may fail under SQL Server 2012 and SQL Server 2014 due to incorrect PowerShell ExecutionPolicy. But it can be easily fixed by modifying the registry.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-26T12:38:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"223\" \/>\n\t<meta property=\"og:image:height\" content=\"152\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nathan Courtine\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nathan Courtine\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/\"},\"author\":{\"name\":\"Nathan Courtine\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/38305b5ebdcdb4fb784fa31d760862d1\"},\"headline\":\"syspolicy_purge_history job and PowerShell ExecutionPolicy\",\"datePublished\":\"2016-04-26T12:38:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/\"},\"wordCount\":610,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png\",\"keywords\":[\"PowerShell\",\"SQL Server\",\"SQL Server 2012\",\"SQL Server 2014\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/\",\"name\":\"syspolicy_purge_history job and PowerShell ExecutionPolicy - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png\",\"datePublished\":\"2016-04-26T12:38:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/38305b5ebdcdb4fb784fa31d760862d1\"},\"description\":\"syspolicy_purge_history may fail under SQL Server 2012 and SQL Server 2014 due to incorrect PowerShell ExecutionPolicy. But it can be easily fixed by modifying the registry.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png\",\"width\":223,\"height\":152},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"syspolicy_purge_history job and PowerShell ExecutionPolicy\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/38305b5ebdcdb4fb784fa31d760862d1\",\"name\":\"Nathan Courtine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0fcc6c91bbc35c976c9d470585e48ae5d500680f1f55de5bbc5f8373b8ebb02c?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0fcc6c91bbc35c976c9d470585e48ae5d500680f1f55de5bbc5f8373b8ebb02c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0fcc6c91bbc35c976c9d470585e48ae5d500680f1f55de5bbc5f8373b8ebb02c?s=96&d=mm&r=g\",\"caption\":\"Nathan Courtine\"},\"description\":\"Nathan Courtine has more than four years of experience in Microsoft solutions. He is specialized in SQL Server installation, migration, performance analysis, best practices, etc. Moreover, he has a background in Oracle Java and .NET software and web development. Nathan Courtine is Microsoft Certified in Administering SQL Server 2012 Databases. Nathan Courtine holds an Engineer\u2019s Degree in Computer Science from the ENSISA (Ecole Nationale Sup\u00e9rieure d'Ing\u00e9nieurs Sud Alsace) in Mulhouse (F). His branch-related experience covers Public Sector, Automotive, IT, Financial Services \/ Banking, etc.\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/nathan-courtine\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"syspolicy_purge_history job and PowerShell ExecutionPolicy - dbi Blog","description":"syspolicy_purge_history may fail under SQL Server 2012 and SQL Server 2014 due to incorrect PowerShell ExecutionPolicy. But it can be easily fixed by modifying the registry.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/","og_locale":"en_US","og_type":"article","og_title":"syspolicy_purge_history job and PowerShell ExecutionPolicy","og_description":"syspolicy_purge_history may fail under SQL Server 2012 and SQL Server 2014 due to incorrect PowerShell ExecutionPolicy. But it can be easily fixed by modifying the registry.","og_url":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/","og_site_name":"dbi Blog","article_published_time":"2016-04-26T12:38:47+00:00","og_image":[{"width":223,"height":152,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png","type":"image\/png"}],"author":"Nathan Courtine","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nathan Courtine","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/"},"author":{"name":"Nathan Courtine","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/38305b5ebdcdb4fb784fa31d760862d1"},"headline":"syspolicy_purge_history job and PowerShell ExecutionPolicy","datePublished":"2016-04-26T12:38:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/"},"wordCount":610,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png","keywords":["PowerShell","SQL Server","SQL Server 2012","SQL Server 2014"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/","url":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/","name":"syspolicy_purge_history job and PowerShell ExecutionPolicy - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png","datePublished":"2016-04-26T12:38:47+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/38305b5ebdcdb4fb784fa31d760862d1"},"description":"syspolicy_purge_history may fail under SQL Server 2012 and SQL Server 2014 due to incorrect PowerShell ExecutionPolicy. But it can be easily fixed by modifying the registry.","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/syspolicy_purge_history-1.png","width":223,"height":152},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/syspolicy_purge_history-job-and-powershell-executionpolicy\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"syspolicy_purge_history job and PowerShell ExecutionPolicy"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/38305b5ebdcdb4fb784fa31d760862d1","name":"Nathan Courtine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0fcc6c91bbc35c976c9d470585e48ae5d500680f1f55de5bbc5f8373b8ebb02c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0fcc6c91bbc35c976c9d470585e48ae5d500680f1f55de5bbc5f8373b8ebb02c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0fcc6c91bbc35c976c9d470585e48ae5d500680f1f55de5bbc5f8373b8ebb02c?s=96&d=mm&r=g","caption":"Nathan Courtine"},"description":"Nathan Courtine has more than four years of experience in Microsoft solutions. He is specialized in SQL Server installation, migration, performance analysis, best practices, etc. Moreover, he has a background in Oracle Java and .NET software and web development. Nathan Courtine is Microsoft Certified in Administering SQL Server 2012 Databases. Nathan Courtine holds an Engineer\u2019s Degree in Computer Science from the ENSISA (Ecole Nationale Sup\u00e9rieure d'Ing\u00e9nieurs Sud Alsace) in Mulhouse (F). His branch-related experience covers Public Sector, Automotive, IT, Financial Services \/ Banking, etc.","url":"https:\/\/www.dbi-services.com\/blog\/author\/nathan-courtine\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=7687"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7687\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/7703"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=7687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=7687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=7687"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=7687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}