How to Use Windows PowerShell ‘Get-AppLockerPolicy’ for Security Audits

The Zero-Trust Security Model

In modern enterprise environments, relying on traditional antivirus software is no longer sufficient. If a user receives a malicious .exe file in a phishing email and clicks it, the damage is done instantly.

To achieve a “Zero-Trust” security posture, Windows Administrators use AppLocker (Application Control Policies). Instead of trying to identify bad software, AppLocker blocks absolutely everything by default. A user can only run an application if the IT department has explicitly whitelisted it.

While AppLocker policies are traditionally built in the graphical Group Policy Editor, managing and auditing these massive XML rulesets across thousands of computers is impossible without automation. To programmatically extract and analyze these security rules, administrators use the PowerShell cmdlet: Get-AppLockerPolicy.

1. Auditing the Local Security Policy

Before you deploy a new security rule, you must understand what rules are currently active on the workstation.

Get-AppLockerPolicy -Local

This command pulls the raw AppLocker configuration directly from the local Windows registry. However, the output is a complex object. To see the actual rules, you must dive into the specific collections.

2. Extracting Specific Rule Collections

AppLocker divides its rules into different buckets: Executables (.exe), Windows Installers (.msi), Scripts (.ps1, .vbs), and Packaged Apps (UWP apps).

To extract a pristine, readable list of every single executable (.exe) rule currently enforced on the computer:

(Get-AppLockerPolicy -Local).RuleCollections | Where-Object { $_.Type -eq 'Exe' } | Select-Object -ExpandProperty Rules

This command pipelines the raw policy, isolates the Executable bucket, and extracts the individual rules. You will see exactly which Publisher Certificates are trusted, which file paths are whitelisted (like C:\Program Files\*), and crucially, which groups of users the rules apply to.

3. Auditing Effective Domain Policies

The -Local flag is only half the story. In a corporate environment, AppLocker policies are usually pushed down from the Domain Controller via Group Policy Objects (GPOs).

If a user complains that they cannot run a specific application, but your local audit shows it is allowed, a Domain GPO might be overriding the local rule.

To merge all local and Domain policies into a single “Effective” policy (exactly how the Windows kernel sees it at runtime):

Get-AppLockerPolicy -Effective

4. Exporting Policies for Analysis (XML)

AppLocker policies are natively stored as massive XML files. If you are migrating your security policies to a new domain, or if you need to submit your current ruleset to a cybersecurity auditor, you must export the configuration to a raw file.

Get-AppLockerPolicy -Effective -Xml | Out-File "C:\SecurityAudits\CurrentAppLockerPolicy.xml"

This single line of PowerShell instantly rips the entire effective security posture of the workstation and saves it as a perfectly formatted XML document.

You can then use the companion cmdlet, Set-AppLockerPolicy, to programmatically import that exact XML file into hundreds of other servers, guaranteeing absolute consistency across your entire infrastructure.

Conclusion

The Get-AppLockerPolicy cmdlet is the cornerstone of advanced Windows application security. By allowing administrators to programmatically extract, audit, and export complex whitelisting rules, it transforms a tedious, manual security configuration into a highly scalable, automated defense matrix.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.