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 ...
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.