-
-
Save p0w3rsh3ll/8aaf05941b6ab7e854668fe464a1a7ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Module Applocker | |
#Requires -PSEdition Desktop | |
#Requires -RunAsAdministrator | |
Function Clear-ApplockerLocalPolicy { | |
[CmdletBinding()] | |
Param() | |
Begin {} | |
Process { | |
Try { | |
$null = Get-AppLockerPolicy -Local -ErrorAction SilentlyContinue | |
[Microsoft.Security.ApplicationId.PolicyManagement.PolicyModel.AppLockerPolicy]::FromXml( | |
@' | |
<AppLockerPolicy Version="1"> | |
<RuleCollection Type="Exe" EnforcementMode="NotConfigured" /> | |
<RuleCollection Type="Msi" EnforcementMode="NotConfigured" /> | |
<RuleCollection Type="Script" EnforcementMode="NotConfigured" /> | |
<RuleCollection Type="Dll" EnforcementMode="NotConfigured" /> | |
<RuleCollection Type="Appx" EnforcementMode="NotConfigured" /> | |
</AppLockerPolicy> | |
'@ | |
) | | |
Set-AppLockerPolicy -ErrorAction Stop | |
Write-Verbose -Message 'Successfully cleared local Applocker policy' | |
} catch { | |
Write-Error $_ | |
} | |
} | |
End {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment