Exporting a policy
In this recipe, we will export a policy to an XML file using PowerShell.
Getting ready
We will export a policy called PW Expiry
to an XML file. To do this we must first create this policy by performing the following steps:
Log in to SQL Server Management Studio, and expand Management | Policy Management.
Right-click on Conditions and select New Condition.
Create a new condition:
Set Name to
PW Expiry Condition
.Select Login Options for Facet.
Use @PasswordExpirationEnabled = True for Expression.
Click on OK when done.
Right-click on Policies and select New Policy.
Create a new policy:
Type
PW Expiry
for Name.Use PW Expiry Condition for Check condition.
Leave the checkbox for Against targets checked, since we want to target every login.
Leave Evaluation Mode to On demand.
Leave Server restriction to None.
Click on OK when done.
Alternatively, you can substitute this with another policy that exists in your system.
How to do it...
To export a policy to an XML file, perform the following...