Test-AppLockerPolicy

Test-AppLockerPolicy

Specifies the AppLocker policy to determine whether the input files will be allowed to run for a given user.

구문

Parameter Set: ByXmlPolicy
Test-AppLockerPolicy [-XmlPolicy] <String> -Path <List<String>> [-Filter <List<PolicyDecision>> ] [-User <String> ] [ <CommonParameters>]

Parameter Set: ByPolicyObject
Test-AppLockerPolicy [-PolicyObject] <AppLockerPolicy> -Path <List<String>> [-Filter <List<PolicyDecision>> ] [-User <String> ] [ <CommonParameters>]

Parameter Set: ByXmlPolicyAppx
Test-AppLockerPolicy [-XmlPolicy] <String> -Packages <List<AppxPackage>> [-Filter <List<PolicyDecision>> ] [-User <String> ] [ <CommonParameters>]

자세한 설명

The Test-AppLockerPolicy cmdlet specifies the AppLocker policy to determine whether a list of files is allowed to run on the local computer for a specified user.

To test AppLocker rules for a nested group, a representative member of the nested group should be specified for the User parameter. For example, a rule that allows the Everyone group to run calc.exe may not appear to apply correctly when the nested Finance group for the User parameter is specified. Instead, a representative member of the Finance group should be specified for the User parameter.

매개 변수

-Filter<List<PolicyDecision>>

Specifies the policy decision by which to filter the output for each input file. 이 매개 변수에 허용되는 값은 다음과 같습니다. Allowed, Denied, DeniedByDefault, or AllowedByDefault.

별칭

없음

필수 여부

false

위치

named

기본값

All

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Packages<List<AppxPackage>>

Specifies a list of installed packaged applications, from which the file information is retrieved.

별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

true (ByValue, ByPropertyName)

와일드카드 문자 허용 여부

false

-Path<List<String>>

Specifies the list of the file paths to test. Regular expressions are supported.

별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

true (ByValue, ByPropertyName)

와일드카드 문자 허용 여부

false

-PolicyObject<AppLockerPolicy>

Specifies the Applocker policy. Can be obtained from the Get-AppLockerPolicy or the New-AppLockerPolicy cmdlet.

별칭

없음

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

true (ByValue, ByPropertyName)

와일드카드 문자 허용 여부

false

-User<String>

Defines the user or group to be used for testing the rules in a specified AppLocker policy. 이 매개 변수에 허용되는 값은 다음과 같습니다.
-- DNS user name (domain\username)
-- User Principal Name (username@domain.com)
-- SAM user name (username)
-- Security identifier (S-1-5-21-3165297888-301567370-576410423-1103)

별칭

없음

필수 여부

false

위치

named

기본값

Everyone

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-XmlPolicy<String>

Specifies the file path and name of the XML-formatted file that contains the AppLocker policy.

별칭

없음

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

  • Microsoft.Security.ApplicationId.PolicyManagement.PolicyModel.AppLockerPolicy

    AppLockerPolicy

출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • Microsoft.Security.ApplicationId.PolicyManagement.AppLockerPolicyDecision

예제

EXAMPLE 1

This example reports if calc.exe and notepad.exe will be allowed to run for Everyone under the policy specified by C:\Policy.xml.

PS C:\> Test-AppLockerPolicy -XMLPath C:\Policy.xml -Path c:\windows\system32\calc.exe, C:\windows\system32\notepad.exe -User Everyone

EXAMPLE 2

This example lists the executables under C:\Windows\System32 that everyone will be denied by the policy specified by C:\Policy.xml because there is no explicit rule for the file.

PS C:\> Get-ChildItem C:\windows\system32\*.exe | Test-AppLockerPolicy c:\Policy.xml -Filter DeniedByDefault

EXAMPLE 3

This example gets the local AppLocker policy, uses the policy to determine which executables in C:\Windows\System32 that contoso\saradavis is explicitly denied access to run, and then redirects the list to a text file.

PS C:\> Get-AppLockerPolicy -Local | Test-AppLockerPolicy -Path C:\Windows\System32\*.exe -User contoso\saradavis -Filter Denied | Format-List -Property | Set-Content (ꞌC:\temp\DeniedFiles.txtꞌ)

EXAMPLE 4

This example lists all the packages installed on this computer, for all the users, and tests them against a saved policy.

PS C:\> Get-AppxPackage –AllUsers | Test-AppLockerPolicy –XmlPolicy .\SamplePolicy.xml

관련 항목

Get-AppLockerFileInformation

Get-AppLockerPolicy

New-AppLockerPolicy

Set-AppLockerPolicy

Get-AppxPackage