Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Set-RuleOption

Module:
ConfigCI Module

Modifies rule options in a Code Integrity policy.

Syntax

Action

Set-RuleOption
 [-FilePath] <String>
 [-Option] <Int32>
 [-Delete]
 [<CommonParameters>]

Help

Set-RuleOption
 [-Help]
 [<CommonParameters>]

Description

The Set-RuleOption cmdlet modifies rule options in a Code Integrity policy. Rule options appear under the Rules property in the .xml policy file. To see the available rule options and their indexes, specify the Help parameter. This cmdlet adds the option that you specify by index. To remove a rule option, specify the Delete parameter.

Examples

Example 1: Remove a rule option

The first command displays the contents of the policy. This example shows only the first few lines of the policy, which include the **Rules** property. One of the options displayed is Enabled:Audit Mode.
PS C:\> Get-Content -Path '.Policy.xml'
<?xml version="1.0" encoding="utf-8"?>
<SiPolicy xmlns="urn:schemas-microsoft-com:sipolicy">
 <VersionEx>10.0.0.0</VersionEx>
 <PolicyTypeID>{A244370E-44C9-4C06-B551-F6016E563076}</PolicyTypeID>
 <PlatformID>{2E07F7E4-194C-4D20-B7C9-6F44A6C5A234}</PlatformID>
 <Rules>
 <Rule>
 <Option>Enabled:Unsigned System Integrity Policy</Option>
 </Rule>
 <Rule>
 <Option>Enabled:Audit Mode</Option>
 </Rule>
 <Rule>
 <Option>Enabled:Advanced Boot Options Menu</Option>
 </Rule>
 <Rule>
 <Option>Enabled:UMCI</Option>
 </Rule>
 </Rules>

The second command removes the Enabled:Audit Mode from Policy.xml.The final command displays the contents of the policy again. Enabled:Audit Mode is no longer part of the policy.
PS C:\> Set-RuleOption -FilePath '.\Policy.xml' -Option 3 -Delete
PS C:\> Get-Content -Path '.Policy.xml'
<?xml version="1.0" encoding="utf-8"?>
<SiPolicy xmlns="urn:schemas-microsoft-com:sipolicy">
 <VersionEx>10.0.0.0</VersionEx>
 <PolicyTypeID>{A244370E-44C9-4C06-B551-F6016E563076}</PolicyTypeID>
 <PlatformID>{2E07F7E4-194C-4D20-B7C9-6F44A6C5A234}</PlatformID>
 <Rules>
 <Rule>
 <Option>Enabled:Unsigned System Integrity Policy</Option>
 </Rule>
 <Rule>
 <Option>Enabled:Advanced Boot Options Menu</Option>
 </Rule>
 <Rule>
 <Option>Enabled:UMCI</Option>
 </Rule>
 </Rules>

This example removes Enabled:Audit Mode from a policy.

Parameters

-Delete

Indicates that this cmdlet removes the rule option that the Option parameter specifies.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:d

Parameter sets

-FilePath

Specifies the path of the policy .xml file that this cmdlet modifies.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:f

Parameter sets

-Help

Indicates that this cmdlet displays the list of available options and their indexes.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:h

Parameter sets

-Option

Specifies the index of the rule option that this cmdlet modifies. Specify the Help parameter for option information. Refer to WDAC Policy Rule Options for more detailed descriptions of each option.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:o

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Related Links


Feedback

Was this page helpful?