Skip to content

Commit

Permalink
This script allows users to execute .exe file from program files only
Browse files Browse the repository at this point in the history
  • Loading branch information
harishsg993010 authored Jan 8, 2023
1 parent 2ea2ec1 commit 65b3b29
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions restrict_exe.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Import the AppLocker module
Import-Module AppLocker

# Create a new AppLocker rule to allow execution of .exe files in the ProgramFiles directory
New-AppLockerPolicyRule -FilePathRuleType Exe -Path "C:\ProgramFiles\*" -Action Allow

# Create a new AppLocker rule to block execution of .exe files in all other directories
New-AppLockerPolicyRule -FilePathRuleType Exe -Path "*" -Action Block

# Enable the AppLocker rules
Set-AppLockerPolicy -PolicyObject (Get-AppLockerPolicy -Effective) -Enabled $true

0 comments on commit 65b3b29

Please sign in to comment.