EPM Power Shell script evaluates all System Policies

Feb 5, 2015 at 11:11 PM
Hello everyone,

I'm installing 4.1.2 on a SQL 2012 server and have made it up to the manual run the PowerShell script as documented on the bottom of page 8 of the EPM Configuration Documentation v4.docx. I only have a single SQL Policy imported (Database Auto Shrink) which is evaluated correctly and I see data for my servers in v_PolicyHistory.

The problem is when I query v_EvaluationErrorHistory, I have a couple of dozen rows of errors that refer to the policies under "System Policies" - things like AlwaysOnAgAutomaticFailoverHealthPolicy.

Question: Is there a way to have the PowerShell script skip the System Policies?


Feb 5, 2015 at 11:26 PM
As a test, I exported AlwaysOnAgAutomaticFailoverHealthPolicy, then deleted it via:

EXEC msdb.dbo.sp_syspolicy_delete_policy @policy_id=36
EXEC msdb.dbo.sp_syspolicy_delete_object_set @object_set_id=36

As a test, I tried to import it (just in case) and the import fails with
Message: Import of 'AlwaysOnAgAutomaticFailoverHealthPolicy.xml' into 'VMDEV-APP11' failed.
Type: Error
Error: Validation failed for Policy 'swb.agdashboard.agp3autofailover.issues.f1'.

Soooo, it doesn't look like deleting the system policies is a good idea because you can't get them back.

Any suggestions?

Aug 10, 2015 at 4:17 PM
Probably too late for Ken but I just changed the line: if (($Policy.PolicyCategory -eq $PolicyCategoryFilter) -or ($PolicyCategoryFilter -eq ""))
to: if (($Policy.PolicyCategory -eq $PolicyCategoryFilter)-or ($PolicyCategoryFilter -eq "") -and ($Policy.CategoryId -gt 8) -and ($Policy.CategoryId -ne 15))
as the Availabilty policies are all in categories 1-8 and 15 is the windows log file. This came from select * from msdb..syspolicy_policy_categories