Evaluating a policy

In this recipe, we will evaluate a policy against our SQL Server instance.

Getting ready

In this recipe, we will evaluate the xp_cmdshell must be disabled policy, which we created in a previous recipe. We also want to export this to an XML file and there are two different ways of evaluating the policy. Use the Exporting a policy recipe to export the xp_cmdshell must be disabled policy and save it in C:\Temp. Alternatively, you can perform the following steps:

  1. Log in to SQL Server Management Studio.
  2. Go to Management | Policy Management and select Policies.
  3. Right-click on the xp_cmdshell must be disabled policy and select Export Policy.
  4. Save this policy in C:\Temp.

Feel free to substitute this with a policy that is available in your ...

Get SQL Server 2014 with PowerShell v5 Cookbook 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.