Forum Discussion

Hellarpk's avatar
Hellarpk
Former Employee
Aug 09, 2023

Power shell Command

I trying to run this command in PowerShell  

 Get-AppLockerPolicy -Effective | Test-AppLockerPolicy -User $env:USERNAME -path “C:\path to file”


I am not sure what to edit in the path location.
I am trying to locate the file to C:\windows\system32\AppLocker.

Still same error.

1 Reply

  • LainRobertson's avatar
    LainRobertson
    Silver Contributor

    Hellarpk 

     

    It would be useful if you could provide the full command you're running as well as the error you're receiving, as all we can do until then is guess.

     

    The -Path parameter takes an array of strings where each string should be the full path to an application or script

     

    Here's a a working example of Test-AppLockerPolicy:

     

    Get-AppLockerPolicy -Effective |
        Test-AppLockerPolicy -User Everyone -Path @(
            "C:\Windows\notepad.exe";
            "D:\Data\Git-2.38.1-64-bit.exe";
        );

     

    And here's two examples in action. The first tests against the Everyone security principal while the second targets a specific user account:

     

     

    Cheers,

    Lain