Set-AppLockerPolicy

Set-AppLockerPolicy is accessible with the help of AppLocker module. To configure AppLocker, go through this link.

Synopsis

Sets the AppLocker policy for the specified GPO.

Description

The Set-AppLockerPolicy cmdlet sets the specified GPO to contain the specified AppLocker policy. If no Lightweight Directory Access Protocol (LDAP) is specified, then the default is the local GPO.

The input values for the AppLocker policy can be an AppLockerPolicy object or an XML-formatted file that contains the AppLocker policy.

Parameters

-InformationAction
Specifies how this cmdlet responds to an information event. The acceptable values for this parameter are:

    -- SilentlyContinue
    -- Stop
    -- Continue
    -- Inquire
    -- Ignore
    -- Suspend

    Required?                    false
    Position?                    named
    Default value                none
    Accept pipeline input?       false
    Accept wildcard characters?  false

-InformationVariable <System.String>
    Specifies a variable in which to store an information event message.

    Required?                    false
    Position?                    named
    Default value                none
    Accept pipeline input?       false
    Accept wildcard characters?  false

-Ldap <String>
    Specifies the LDAP path of the GPO. It must specify a unique GPO. If this parameter is not specified, then the local AppLocker policy is set.

    Required?                    false
    Position?                    named
    Default value                none
    Accept pipeline input?       false
    Accept wildcard characters?  false

-Merge <SwitchParameter>
    Merges the rules in the specified AppLocker policy with the AppLocker rules in the target GPO specified in the LDAP path. The merging of policies will remove rules with duplicate rule IDs, and the enforcement setting specified by the AppLocker policy in the target GPO will be preserved. If the Merge parameter is not specified, then the new policy will overwrite the existing policy.

    Required?                    false
    Position?                    named
    Default value                none
    Accept pipeline input?       false
    Accept wildcard characters?  false

-PolicyObject <AppLockerPolicy>
    Specifies the AppLockerPolicy object that contains the AppLocker policy. Can be obtained from the Get-AppLockerPolicy and the New-AppLockerPolicy cmdlets.

    Required?                    true
    Position?                    1
    Default value                none
    Accept pipeline input?       true (ByValue, ByPropertyName)
    Accept wildcard characters?  false

-XmlPolicy <String>
    Specifies the path where the XML-formatted file that contains the AppLocker policy is saved.

    Required?                    true
    Position?                    1
    Default value                none
    Accept pipeline input?       false
    Accept wildcard characters?  false

Syntax

Set-AppLockerPolicy [-XmlPolicy] <String> [-Ldap <String>] [-Merge] [-WhatIf] [-Confirm] [<CommonParameters>]

Set-AppLockerPolicy [-PolicyObject] <AppLockerPolicy> [-Ldap <String>] [-Merge] [-WhatIf] [-Confirm] [<CommonParameters>]

————–EXAMPLE 1————–
PS C:> Set-AppLockerPolicy -XMLPolicy C:\AppPolicy.xml
This example sets the local AppLocker policy to the policy specified in C:\AppPolicy.xml.

————–EXAMPLE 2————–
PS C:> Set-AppLockerPolicy -XMLPolicy C:\AppPolicy.xml -LDAP “LDAP://Mumbai.TOSSolution.com/CN=gpo1,CN=Policies,CN=System,DC=TOSSolution,DC=com”
This example sets the GPO specified in the LDAP path to contain the AppLocker policy that is specified in C:\AppPolicy.xml.

————–EXAMPLE 2————–
PS C:> Get-AppLockerPolicy -Local | Set-AppLockerPolicy -LDAP “LDAP://Mumbai.TOSSolution.com/CN=gpo1,CN=Policies,CN=System,DC=TOSSolution,DC=com” -Merge
This example gets the local AppLocker policy, and then merges the policy with the existing AppLocker policy in the GPO specified in the LDAP path. For more information on how two policies are merged, see the Merge parameter description.

You can check the Version, CommandType and Source of this cmdlet by giving below command.

Get-Command Set-AppLockerPolicy

Get-Command Set-AppLockerPolicy powershell script command cmdlet

You can also read about

  • Get-AppLockerFileInformation
  • Get-AppLockerPolicy
  • New-AppLockerPolicy
  • Test-AppLockerPolicy

To know more PowerShell cmdlets(Commands) on AppLocker click here

Click on this Link for an Single place where you get all the PowerShell cmdlet sorted based on the modules.

You can also refer other blogs on PowerShell at link

You can also refer other blogs on Microsoft at link

And also if you required any technology you want to learn, let us know below we will publish them in our site http://tossolution.com/

Like our page in Facebook and follow us for New technical information.

References are taken from Microsoft

Leave a Reply

Your email address will not be published. Required fields are marked *