<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'Maintenance' and 'PowerShell'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=Maintenance,PowerShell&amp;orTags=0</link><description>Search results matching tags 'Maintenance' and 'PowerShell'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Automating SQL Server 2005/2000 Policy Evaluation</title><link>http://sqlblog.com/blogs/lara_rubbelke/archive/2009/06/13/automating-sql-server-2005-2000-policy-evaluation.aspx</link><pubDate>Sat, 13 Jun 2009 16:11:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14631</guid><dc:creator>Lara Rubbelke</dc:creator><description>&lt;P align=left&gt;The &lt;A href="http://epmframework.codeplex.com/" target=_blank&gt;Enterprise Policy Management Framework version 3.0&lt;/A&gt;, a new version of the framework to support policy automated policy evaluation for SQL Server 2000 and 2005, has been posted to codeplex.&lt;/P&gt;
&lt;P align=left&gt;For those who are not familiar with the tool, the Enterprise Policy Management Framework is a reporting solution on the state of the SQL Server enterprise against a desired state defined in a policy. The key capabilities are to extend Policy-Based Management to all SQL Server instances in the enterprise, including SQL Server 2000 and SQL Server 2005.&amp;nbsp; The EPM Framework will automate a scheduled evaluation of a set of policies against a group of servers, and provide reports for DBAs to understand where they have instances and database objects which are not complying with an organization’s defined standards.&amp;nbsp; &lt;/P&gt;
&lt;P align=left&gt;The new 3.0 release includes the following enhancements:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P align=left&gt;&lt;B&gt;Supports nested server groups in the Central Management Server&lt;/B&gt;&lt;/P&gt;
&lt;P align=left&gt;The previous versions did not support Central Management Server groups that were nested in parent groups.&amp;nbsp; This restriction has been removed and you may now design CMS groups to fit your organization, and leverage these groups for the EPM Framework.&lt;/P&gt;
&lt;P align=left&gt;&lt;B&gt;A new parameterized PowerShell execution &lt;/B&gt;&lt;/P&gt;
&lt;P align=left&gt;The PowerShell script has been updated with parameters.&amp;nbsp; This enhancement will significantly ease how you may deploy the solution, so you only have a single script to manage.&amp;nbsp; The previous versions would have required multiple versions of the PowerShell script you were to design the execution strategy by server group and policy category.&lt;/P&gt;
&lt;P align=left&gt;&lt;B&gt;Policy results are stored in a table format&lt;/B&gt;&lt;/P&gt;
&lt;P align=left&gt;The new version 3.0 will shred the policy result XML document to a PolicyHistoryDetail table during the evaluation.&amp;nbsp; The previous version only stored the XML data and issued queries against XML results stored in a SQL Server table named PolicyHistory.&amp;nbsp; This update will greatly improve performance during reporting and provides a better platform for the community to build customized views and reports. This could also improve storage – you can purge the data in the PolicyHistory table if you do not require the XML results.&lt;/P&gt;
&lt;P align=left&gt;&lt;B&gt;New Report Parameters &lt;/B&gt;&lt;/P&gt;
&lt;P align=left&gt;Based on feedback from the community, the new version includes parameters in the reports to support filtering by Central Management Server group.&amp;nbsp; This will be a very important criteria for large organizations who would like to focus on specific groups of instances.&lt;/P&gt;
&lt;P align=left&gt;&lt;B&gt;Fixes to error reporting logic&lt;/B&gt;&lt;/P&gt;
&lt;P align=left&gt;Not much to say, other than the logic that identifies errors stored in the tables is fixed.&lt;/P&gt;
&lt;P align=left&gt;&lt;STRONG&gt;Updated Documentation&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align=left&gt;The documentation has been updated, and should be much easier to follow when setting up the framework.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P align=left&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=left&gt;The EPM Framework leverages the Central Management Server, PowerShell, Reporting Services 2008, and Policy-Based Management.&amp;nbsp; You will need at least one instance of SQL Server 2008 and an instance of SQL Server 2008 Reporting Services to support the framework.&amp;nbsp; I will dive deeper into installation and configuration of the framework in subsequent blogs.&amp;nbsp; &lt;/P&gt;
&lt;P align=left&gt;Please let me know if you are using the framework, and if you have suggestions for future enhancements.&amp;nbsp; I am going to be integrating SQL Server 2008 Policy History centralization into the framework in the next version.&lt;/P&gt;
&lt;P align=left&gt;&lt;A href="http://sqlblog.com/blogs/lara_rubbelke/DashboardScreenShot30_613E49C2.jpg"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH:0px;DISPLAY:inline;BORDER-TOP-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-LEFT-WIDTH:0px;" title=DashboardScreenShot30 border=0 alt=DashboardScreenShot30 src="http://sqlblog.com/blogs/lara_rubbelke/DashboardScreenShot30_thumb_3E9A0B47.jpg" width=601 height=527&gt;&lt;/A&gt;&lt;/P&gt;</description></item><item><title>Enterprise Policy Management: Updates, New Whitepaper, and Upcoming Webcast</title><link>http://sqlblog.com/blogs/lara_rubbelke/archive/2009/03/04/enterprise-policy-management-updates-new-whitepaper-and-upcoming-webcast.aspx</link><pubDate>Wed, 04 Mar 2009 15:21:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12425</guid><dc:creator>Lara Rubbelke</dc:creator><description>&lt;P align=left&gt;The next version of the &lt;A href="http://www.codeplex.com/EPMFramework" target=_blank&gt;Enterprise Policy Management Framework&lt;/A&gt; has been published to CodePlex.&amp;nbsp; The new version includes error trapping and error reporting, and a few bug fixes.&amp;nbsp; Please be sure to download the documentation as well, which will help you understand how to use the PowerShell variables to scale the execution in your environment.&amp;nbsp; &lt;/P&gt;
&lt;P align=left&gt;A new &lt;A href="http://msdn.microsoft.com/en-us/library/dd542632.aspx" target=_blank&gt;whitepaper has been published&lt;/A&gt; outlining the intent of the Enterprise Policy Management Framework. A big thank you to Tom Davidson for all of the hard work writing the paper.&lt;/P&gt;
&lt;P align=left&gt;Finally, anyone who is interested in an introduction to Policy-Based Management and a demonstration of the EPM Framework in action can attend my TechNet webcast next Thursday, March 12: &lt;A href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032402179&amp;amp;EventCategory=4&amp;amp;culture=en-US&amp;amp;CountryCode=US" target=_blank&gt;TechNet Webcast: Governing Your Enterprise with Policy-Based Management (Level 300)&lt;/A&gt;.&amp;nbsp; This webcast is best suited for those of you who…:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV align=left&gt;are currently frustrated with managing a SQL Server environment that is inconsistently deployed&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV align=left&gt;want to reduce the time you spend developing and running scripts to determine issues in business and regulatory compliance&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV align=left&gt;simply want to see a better way to manage groups of servers to better scale your time&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P align=left&gt;Join in the webcast, it is sure to be fun and enlightening!&amp;nbsp; In short, you will walk away with an understanding of Policy-Based Management, how to use the SQL Server 2008 Policy-Based Management framework to support down-version (SQL Server 2000 and 2005) policy evaluation, and how to implement the EPM framework (see picture below) for an understanding of policy compliance across the enterprise.&amp;nbsp; &lt;/P&gt;
&lt;P align=left&gt;&lt;A href="http://sqlblog.com/blogs/lara_rubbelke/image_34714CF6.png"&gt;&lt;IMG title=image style="BORDER-RIGHT:0px;BORDER-TOP:0px;DISPLAY:block;FLOAT:none;MARGIN-LEFT:auto;BORDER-LEFT:0px;MARGIN-RIGHT:auto;BORDER-BOTTOM:0px;" height=484 alt=image src="http://sqlblog.com/blogs/lara_rubbelke/image_thumb_6895506F.png" width=576 border=0&gt;&lt;/A&gt;&lt;/P&gt;</description></item><item><title>Evaluating Policies On Demand Through PowerShell</title><link>http://sqlblog.com/blogs/lara_rubbelke/archive/2008/06/19/evaluating-policies-on-demand-through-powershell.aspx</link><pubDate>Thu, 19 Jun 2008 04:22:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:7379</guid><dc:creator>Lara Rubbelke</dc:creator><description>&lt;P&gt;&lt;A class="" href="http://sqlblog.com/blogs/lara_rubbelke/archive/2008/06/13/policy-evaluation-on-a-single-sql-server-2008-instance.aspx" target=_blank&gt;In my previous blog&lt;/A&gt; I reviewed the different policy evaluation modes available in SQL Server 2008.&amp;nbsp; In this next installment I will detail how to initiate a policy on demand using PowerShell.&lt;/P&gt;
&lt;P&gt;PowerShell integration with SQL Server 2008 is getting more press lately.&amp;nbsp; &lt;A class="" href="http://sqlblog.com/blogs/lara_rubbelke/archive/2008/04/22/powershell-learning-resources-_2D00_-online.aspx" target=_blank&gt;In past blogs&lt;/A&gt; I noted a few resources to help learn PowerShell, and since that time additional resources (&lt;A href="http://blogs.technet.com/industry_insiders/pages/powershell-in-sql-server-2008.aspx"&gt;http://blogs.technet.com/industry_insiders/pages/powershell-in-sql-server-2008.aspx&lt;/A&gt; and &lt;A href="http://blogs.msdn.com/mwories/archive/2008/06/14/SQL2008_5F00_Powershell.aspx"&gt;http://blogs.msdn.com/mwories/archive/2008/06/14/SQL2008_5F00_Powershell.aspx&lt;/A&gt; to call out a few) continue to surface.&amp;nbsp; This blog series is focused on Policy Evaluation, so I will be specifically looking at the new PowerShell cmdlet available in SQL Server 2008 to support an on demand evaluation of policies.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The cmdlet &lt;B&gt;Invoke-PolicyEvaluation&lt;/B&gt; will allow you to specify a policy (or set of policies) to be evaluated against a target server.&amp;nbsp; The general syntax is as follows:&lt;/P&gt;
&lt;P&gt;Invoke-PolicyEvaluation [-Policy [(&amp;lt;string[]&amp;gt; | &amp;lt;Policy&amp;gt; | &amp;lt;FileInfo&amp;gt;)]] -TargetServerName &amp;lt;(string | ISfcConnection)&amp;gt;&amp;nbsp; [-TargetExpression&amp;nbsp; &amp;lt;string&amp;gt;] [-OutputXml] [-AdHocPolicyExecutionMode &amp;lt;AdHocPolicyExecutionMode&amp;gt;]&lt;/P&gt;
&lt;P&gt;To open the SQL Server PowerShell provider through Management Studio, right-click on the Server and select Start PowerShell.&amp;nbsp; &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;I&gt;Note: You can also add the SQL Server PowerShell provider into the main PowerShell.&amp;nbsp; Open PowerShell and run the following commands to load the SQL Server snap-ins.&amp;nbsp; These are documented incorrectly in SQL Server 2008 RC0 BOL.&lt;/I&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;add-pssnapin SqlServerCmdletSnapin100&lt;/P&gt;
&lt;P&gt;add-pssnapin SqlServerProviderSnapin100&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Once you are in PowerShell, we can execute our commands to evaluate a policy.&amp;nbsp; I encourage you to issue the following command, which will return a very detailed report on the cmdlet:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Get-Help Invoke-PolicyEvaluation -Detailed&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A very simple example will assume that you have the SQL Server 2008 sample policies installed in the default location.&amp;nbsp; On my laptop, they are located at "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Policies\DatabaseEngine\1033".&amp;nbsp; &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;#Set the working location to the file with our sample policies&lt;/P&gt;
&lt;P&gt;sl "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Policies\DatabaseEngine\1033"&lt;/P&gt;
&lt;P&gt;Invoke-PolicyEvaluation -Policy "Database Auto Close.xml" -TargetServer "MyServerName"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Executing these commands will return the output on the console with the results of the policy evaluation.&amp;nbsp; Note that these results are NOT stored&amp;nbsp;in the MSDB&amp;nbsp;database (as other&amp;nbsp;evaluation modes will do).&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you would like to evaluate multiple policies, they are passed as a comma separated list as follows:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;#Set the working location to the file with our sample policies&lt;/P&gt;
&lt;P&gt;sl "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Policies\DatabaseEngine\1033"&lt;/P&gt;
&lt;P&gt;Invoke-PolicyEvaluation -Policy "Database Auto Close.xml", "Database Auto Shrink" -TargetServer "MyServerName"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The Invoke-PolicyEvaluation cmdlet can accept inputs from a pipe.&amp;nbsp; The following example will loop through and evaluate each policy stored in the file against the server.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;sl "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Policies\DatabaseEngine\1033"&lt;/P&gt;
&lt;P&gt;gci | Invoke-PolicyEvaluation -TargetServer "MyServerName"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By default, the -AdHocPolicyExecutionMode parameter is "Check", which will simply evaluate the policy and report back through the console or through an XML output file.&amp;nbsp; The "Configure" option will reconfigure properties that failed compliance so they comply with the policy, as long as they are deterministic and settable.&amp;nbsp; &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;sl "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Policies\DatabaseEngine\1033"&lt;/P&gt;
&lt;P&gt;Invoke-PolicyEvaluation -Policy "Database Auto Close.xml", "Database Auto Shrink" -TargetServer "MyServerName" -AdHocPolicyExecutionMode "Configure"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The final parameter I want to point out is the -OutputXml, which will produce an XML report.&amp;nbsp; As mentioned above, the policy evaluation results are not stored in the MSDB database.&amp;nbsp; Using this parameter, you can produce an output file which will be very useful when you want to review the information at a later time.&amp;nbsp; &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;sl "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Policies\DatabaseEngine\1033"&lt;/P&gt;
&lt;P&gt;Invoke-PolicyEvaluation -Policy "Database Auto Close.xml" -TargetServer "MyServerName" -OutputXml &amp;gt;"Report.xml"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So, yes you can evaluate a policy on demand through PowerShell.&amp;nbsp; You can create a SQL Server Agent Job with a step that executes your PowerShell script (new in 2008).&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I can hear what many of you are thinking - "&amp;lt;insert your name here&amp;gt;, why would I need to use this feature if I can simply create a policy on SQL Server 2008 and let the policy manage the server and have the output stored in MSDB?"&amp;nbsp; In my opinion, the policy &lt;I&gt;&lt;U&gt;should be&lt;/U&gt;&lt;/I&gt; on the server when your server is SQL Server 2008.&amp;nbsp; The server &lt;I&gt;&lt;U&gt;should be &lt;/U&gt;&lt;/I&gt;managed by the policy whenever possible.&amp;nbsp; However... What if you want to evaluate a policy against a SQL Server 2000 or 2005 instance?&amp;nbsp; Aha!&amp;nbsp; Now you have a real use case for invoking policy evaluation through PowerShell.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is just a brief overview of some of the ways to use this cmdlet, but as with all PowerShell and SQL implementations there are multiple ways to put these into action.&amp;nbsp; In the next parts of the series,&amp;nbsp;I will explore central management servers, data collectors, and examples on how to extend this cmdlet for an enterprise solution.&lt;/P&gt;</description></item></channel></rss>