
If you have existing rules within this policy, be sure to use the –Merge switch. \MDOP.XML -LDAP "LDAP:///CN=,CN=Policies,CN=System,DC=TEST,DC=local" Here is an example: Set-AppLockerPolicy –XMLPolicy. With your GUID, you can now import your rules into a GPO by using the –LDAP parameter in Set-AppLockerPolicy. For me, getting the GUID is easier in PowerShell than the GPMC, just run Get-GPO –name GPONAME | Select-Object DisplayName,ID Importing rules into a GPO is slightly difficult because you need the GUID for the GPO. Though you shouldn’t have many local AppLocker rules in a domain environment, you should at least see the MDOP rule that we applied above. The GridView output will list any local rules applicable to our system. We can verify that our policy was imported by running: Get-AppLockerPolicy -Local -Xml | Out-GridView To apply the MDOP.XML rules locally, we can run: Set-AppLockerPolicy –XMLPolicy. Both of these methods are handled with the Set-AppLockerPolicy cmdlet. In order to apply this policy, we can either import the rules into the local AppLocker rule set or import the rules into a specific GPO. Generating an XML file won’t apply our AppLocker rules. \MDOP.xml -Path \\SERVER\SHARE\MDOP\UE-VX86.exe Setting our AppLocker rules In the example below, I am testing MDOP.XML against a file on a share. Testing can be done by running Test-AppLockerPolicy against specific files. Testing allows us to correct mistakes before we accidently block a needed file.

\MDOP.XMLīefore applying our AppLocker rules to a machine (or to a GPO), we will want to test them first. Get-AppLockerFileInformation -Directory \\SHARE\SERVER\Microsoft\MDOP\ -Recurse | New-AppLockerPolicy -RuleType Publisher,Hash -User Everyone -RuleNamePrefix MDOP -XML | Out-File. The results are then exported to the file MDOP.XML. Here is an example that searches the MDOP folder and creates a new AppLocker Policy. We can quickly create rules by using Get-AppLockerFileInformation and piping the output to New-AppLockerPolicy. In the top right, note the ability to filter results! Creating and testing an AppLocker policy To make sorting easier, we can pipe any output to the Out-GridView cmdlet. Though part of the directory path has been removed, you can still see how useful this cmdlet is for planning. This command will recursively search a directory: Get-AppLockerFileInformation –Directory “\\SERVER\SHARE\FOLDER” -Recurse Path locations should not allow standard users to have write access.īy using Get-AppLockerFileInformation, we can scan files or directories to see what rule types will be supported.

#Configure applocker windows
As the Windows AppLocker Guide points out, individual rules should be built in this order and for these reasons: Files can be grouped by their path, their publisher, or their hash. Our five AppLocker cmdlets Path, publisher, or hashĪppLocker can allow or block applications based on three types of criteria. To start our PowerShell exploration, open PowerShell ISE and type Get-Command -Module AppLocker

Don’t let the small number of commands fool you! With the exception of a removal command, they are more than enough to handle the complete policy lifecycle. The AppLocker module for PowerShell contains five cmdlets.
