Policies

We can check out policies in a SQL Server instance as well, by using PowerShell. Instead of using SMO, we can use the SQLSERVER PSDrive. You can first change your location to the SQLPolicy node:

Set-Location "SQLSERVER:\SQLPolicy\YourSqlServerMachineName"

You can use dir or Get-ChildItem to navigate to the available instances:

Policies

Change the location to the instance you are working with. When you list the current items, you should find all the policy-related objects:

Policies

If you navigate to Policies, you will be able to see all the policies that are ...

Get PowerShell for SQL Server Essentials 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.