{"id":130,"date":"2015-09-08T00:00:00","date_gmt":"2013-01-01T00:00:00","guid":{"rendered":"https:\/\/www.sqlhammer.com\/blog\/policy-based-management-tsql2sday-70"},"modified":"2026-03-18T21:52:08","modified_gmt":"2026-03-18T21:52:08","slug":"policy-based-management-tsql2sday-70","status":"publish","type":"post","link":"https:\/\/sqlhammer.com\/index.php\/2015\/09\/08\/policy-based-management-tsql2sday-70\/","title":{"rendered":"Policy Based Management Templates &#8211; TSQL2sDay #70 &#8211; SQL Hammer"},"content":{"rendered":"<p>T-SQL Tuesday (aka #TSQL2sday) is a monthly SQL Server blogger event started back in late 2009 by Adam Machanic (<a href=\"http:\/\/sqlblog.com\/blogs\/adam_machanic\">blog<\/a> | <a href=\"http:\/\/www.twitter.com\/adammachanic\">twitter<\/a>). The first topic was about Date\/Time Tricks. Read\u00a0<a href=\"http:\/\/sqlblog.com\/blogs\/adam_machanic\/archive\/2009\/11\/30\/invitation-to-participate-in-t-sql-tuesday-001-date-time-tricks.aspx\">the original TSQL2sday call-out<\/a>. Each month a different SQL Server blogger is the host who announces the topics and performs the round-up. A big thanks goes out to Jen McCown (<a href=\"http:\/\/www.midnightdba.com\/Jen\/\">b<\/a> | <a href=\"https:\/\/twitter.com\/MidnightDBA\">t<\/a>), one of the renowned\u00a0<a href=\"http:\/\/midnightdba.itbookworm.com\/\">Midnight DBAs<\/a>, for hosting T-SQL Tuesday #70, <a href=\"http:\/\/www.midnightdba.com\/Jen\/2015\/09\/time-for-t-sql-tuesday-70\/?utm_content=buffer379a4&#038;utm_medium=social&#038;utm_source=twitter.com&#038;utm_campaign=buffer\">strategies for managing an enterprise<\/a>.<\/p>\n<p><a href=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/TSQL2sDay150x150.jpg\"><img decoding=\"async\" src=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/TSQL2sDay150x150.jpg\" alt=\"\" \/><\/a><\/p>\n<p>As one of my strategies for managing an enterprise I\u2019d like to talk about <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/bb510667.aspx\">Policy Based Management<\/a>. Policy based management (PBM) enables you to verify best practices and corporate policies across a large enterprise. You execute policy checks from a central management server and retrieve results for those that violate the policies. PBM is a great way of finding loose threads and keeping your enterprise tight.<\/p>\n<p>For someone just starting out with policy based management, it can be a challenge to brainstorm every best practice or policy that you would like to enforce. That is the reason for this blog post. Microsoft has provided us almost six\u00a0dozen policies with the installation of SQL Server which can be imported as a great jump-off point with PBM. The unfortunate part is that you would not be able to find these best practice policies by just stumbling around in SQL Server Management Studio.<\/p>\n<h2>Importing policy based management templates<\/h2>\n<p>MSDN informs of us the location of the PBM templates <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/hh710056.aspx\">here<\/a>. The exact file path will vary for each version.<\/p>\n<p>> C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Policies\\DatabaseEngine\\1033<\/p>\n<p>Begin by opening SQL Server Management Studio (SSMS) and navigating to Management > Policy Management.<\/p>\n<p><a href=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-workthrough-1.png\"><img decoding=\"async\" src=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-workthrough-1.png\" alt=\"\" \/><\/a><\/p>\n<p>Right-click Policies and select Import Policy\u2026<\/p>\n<p><a href=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-workthrough-2.png\"><img decoding=\"async\" src=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-workthrough-2.png\" alt=\"\" \/><\/a><\/p>\n<p>Browse to the path of the policy files, select all of the files, and click open.<\/p>\n<p><a href=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-workthrough-3.png\"><img decoding=\"async\" src=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-workthrough-3.png\" alt=\"\" \/><\/a><\/p>\n<p>On the next dialog box, decide whether you want these policies to be imported in the disabled or enabled state and select OK.<\/p>\n<p><a href=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-workthrough-4.png\"><img decoding=\"async\" src=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-workthrough-4.png\" alt=\"\" \/><\/a><\/p>\n<p><strong>That\u2019s it!\u00a0Your policies have been imported.\u00a0<\/strong><\/p>\n<p>We now have 66 imported policies and 89 new conditions.<\/p>\n<pre><code class=\"language-\">SELECT COUNT(<em>) [PolicyCount] FROM msdb.dbo.syspolicy_policies\nSELECT COUNT(<\/em>) [ConditionCount] FROM msdb.dbo.syspolicy_conditions<\/code><\/pre>\n<p><a href=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-template-counts-2014.png\"><img decoding=\"async\" src=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-template-counts-2014.png\" alt=\"\" \/><\/a><\/p>\n<p>These are simply a starting point. I am not recommending that you start modifying your servers to meet these conditions. What I am recommending is that you evaluate each policy and decide whether or not it fits your enterprise. Drill into the Policies folder in SSMS\u2019s object explorer and view the policy properties for a description. Note that there is an\u00a0<em>address<\/em> block where you can reference more information on MSDN. You can also look at the full list of policies and their details <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/cc645723.aspx\">here<\/a>.<\/p>\n<p><a href=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-desc.png\"><img decoding=\"async\" src=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-desc.png\" alt=\"\" \/><\/a><\/p>\n<p>When you decide to implement one of the policies, edit it and add a schedule to catch drift from your policies.<\/p>\n<p><a href=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-schedules.png\"><img decoding=\"async\" src=\"http:\/\/www.sqlhammer.com\/blog\/wp-content\/uploads\/2015\/09\/PBM-schedules.png\" alt=\"\" \/><\/a><\/p>\n<p>From here you should be well on your way towards establishing your enterprise\u2019s policies and have an efficient method of enforcing them.<\/p>\n<hr \/>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/hammer-derik-172x140.png\" alt=\"\" \/><strong>Written by Derik Hammer of <a href=\"http:\/\/www.sqlhammer.com\/\">SQL Hammer<\/a><\/strong><\/p>\n<p>Derik is a data professional focusing on Microsoft SQL Server. His passion focuses around <a href=\"http:\/\/www.sqlhammer.com\/blog\/category\/high-availability\/\">high-availability<\/a>, <a href=\"http:\/\/www.sqlhammer.com\/blog\/category\/general\/disaster-recovery\/\">disaster recovery<\/a>, continuous integration, and automated maintenance. his experience has spanned long-term database administration, consulting, and\u00a0entrepreneurial ventures.<\/p>\n<p>Derik gives the SQL community credit for plugging the gaps in his knowledge when he was a junior DBA and, now that his skills have matured, started <a href=\"http:\/\/www.sqlhammer.com\/\">SQLHammer.com<\/a> as one small way to give back and continue the cycle of shared learning.<\/p>\n<p>Derik is the owner and lead author of SQL Hammer, a <a href=\"http:\/\/www.sqlhammer.com\/\">Microsoft SQL Server resource<\/a>.<\/p>\n<p>For more information, visit <a href=\"http:\/\/www.sqlhammer.com\/\">http:\/\/www.sqlhammer.com<\/a>. Follow Derik on <a href=\"http:\/\/twitter.com\/SQLHammer\">Twitter<\/a> for <strong>SQL tips and chat<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>T-SQL Tuesday (aka #TSQL2sday) is a monthly SQL Server blogger event started back in late 2009 by Adam Machanic (blog | twitter). The first topic was about Date\/Time Tricks. Read\u00a0the original TSQL2sday call-out. Each month a different SQL Server blogger is the host who announces the topics and performs the round-up. A big thanks goes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":541,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-130","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/posts\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":1,"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"predecessor-version":[{"id":392,"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/posts\/130\/revisions\/392"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/media\/541"}],"wp:attachment":[{"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlhammer.com\/index.php\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}