In this recipe, we will list policies deployed in our SQL Server instance.
Check which policies are being used in your environment using SQL Server Management Studio. Connect to SSMS and navigate to Management | Policy Based Management | Policies:
These are the same policies you should get after you run the PowerShell script in this recipe.
To list policies using PowerShell, perform the following steps:
SQLPSmodule as follows:
#import SQL Server module Import-Module SQLPS -DisableNameChecking
#replace with your server information ...