Cmdlet Example: Invoke-PolicyEvaluation

Another one of the provided cmdlets is Invoke-PolicyEvaluation. This cmdlet is used to specify a SQL Server Policy-Based Management policy (or policies) that will be evaluated against the target server. You can easily cycle through all the available policies and evaluate each one, or simply provide a list of policies to evaluate separated by a comma. Consider this example:

sl "C:\Program Files\Microsoft SQL Server\110\Tools\Policies\DatabaseEngine\1033"Invoke-PolicyEvaluation -Policy "Database Auto Shrink.xml" -TargetServerName"MSSQLSERVER"

The preceding command returns the output to the console of the result of the policy evaluation. By default, the particular policy passed ...

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.