Listing facets and their properties
In this recipe, we will list all available facets and their properties.
How to do it...
Let's take a look at the steps for listing facets and their properties:
- Open PowerShell ISE as an administrator. Import the
SQLPS
module as follows:#import SQL Server module Import-Module SQLPS -DisableNameChecking
- Add the following script and run it:
$result = @() [Microsoft.SqlServer.Management.Dmf.PolicyStore]::Facets | ForEach-Object { $facet = $_ $facet.FacetProperties | ForEach-Object { $property = $_ $item = [PSCustomObject] @{ Name = $facet.Name PropertyName = $property.Name PropertyType = $property.PropertyType } $result += $item } } $result | 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) feature. PBM is a...