Listing facets and facet properties
In this recipe, we will list all available facets and their properties.
How to do it...
Open the PowerShell console by going to Start | Accessories | Windows PowerShell | Windows PowerShell ISE.
Import the
SQLPS
module as follows:#import SQL Server module Import-Module SQLPS -DisableNameChecking
Add the following script and run:
[Microsoft.SqlServer.Management.Dmf.PolicyStore]::Facets | ForEach-Object { $facet = $_ $facet.FacetProperties | Select @{N="FacetName";E={$facet.Name}}, @{N="PropertyName";E={$_.Name}}, @{N="PropertyType";E={$_.PropertyType}} } | Format-Table
When the script successfully finishes executing, the resulting screen should display all the facets and their properties.
How it works...
Facets are introduced with SQL Server 2008's Policy Based Management (PBM). Facets are defined in MSDN as follows:
a set of logical properties that model the behavior or characteristics for certain types of managed targets.
Simply, these are...