This project is read-only.

[This command is not available in non-domain environments]

Get-AppLockerFileInformation

Synopsis

Gets the file information necessary to create AppLocker rules from a list of files or an event log.

Syntax

Get-AppLockerFileInformation [[-Path] <List`1[String]>] [<CommonParameters>]

Get-AppLockerFileInformation [[-Packages] <List`1[AppxPackage]>] [<CommonParameters>]

Get-AppLockerFileInformation -Directory <String> [-FileType <List`1[AppLockerFileType]> {Exe | Dll | WindowsInstaller | Script | Appx} ] [-Recurse] [<CommonParameters>]

Get-AppLockerFileInformation -EventLog <SwitchParameter> [-LogPath <String>] [-EventType <List`1[AppLockerEventType]>] [-Statistics] [<CommonParameters>]

Description

The Get-AppLockerFileInformation cmdlet gets the AppLocker file information from a list of files or an event log.

File information includes the publisher information, file hash, and file path.The file information from an event log may not contain all of the publisher information, file hash, and file path fields. Files that are not signed will not have any publisher information.

Parameters

-Path <List`1[String]>

Specifies a list of paths to the files from which the file information is retrieved. Supports regular expressions.

Required? False
Position? 0
Default value  
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? False

-Packages <List`1[AppxPackage]>

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

Required? False
Position? 0
Default value  
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? False

-Directory <String>

Specifies the directory containing the files for which to get the file information. If all subfolders and files in the specified directory are to be searched, then include the Recurse parameter

Required? True
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-FileType <List`1[AppLockerFileType]>

Specifies the generic file type for which to search. All files having the appropriate file name extension will be included.
The acceptable values for this parameter are:  EXE, Script, MSI, and DLL.

Required? False
Position? named
Default value Exe, Script, MSI, Dll
Accept pipeline input? false
Accept wildcard characters? False

-Recurse <SwitchParameter>

Specifies that all files and folders within the specified directory will be searched.

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-EventLog <SwitchParameter>

Specifies that the file information is retrieved from the event log.

Required? True
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-LogPath <String>

Specifies the log name or file path of the event log where the AppLocker events are located. If this parameter is not specified, the local Microsoft-Windows-AppLocker/EXE and DLL channel is used by default.

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-EventType <List`1[AppLockerEventType]>

Specifies the event type by which to filter the events. The acceptable values for this parameter are:  Allowed, Denied, or Audited. The event types correspond to the Informational, Error, and Warning level events in the AppLocker event logs.

Required? False
Position? named
Default value Allowed, Denied, Audited
Accept pipeline input? false
Accept wildcard characters? False

-Statistics <SwitchParameter>

Specifies the statistics to retrieve on the files included in the event log. Calculates a simple sum of the number of times a file is included in the event log based upon specified parameters.

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

None

Outputs

Microsoft.Security.ApplicationId.PolicyManagement.PolicyModel.FileInformation

Notes

Examples

EXAMPLE 1

PS C:\>Get-AppLockerFileInformation -Directory C:\Windows\system32\ -Recurse -FileType exe, script

This example gets the file information for all the .exe files and scripts under %windir%\system32.

EXAMPLE 2

PS C:\>Get-AppLockerFileInformation -Path "C:\Program Files (x86)\Internet Explorer\iexplore.exe" | Format-List
Path      : %PROGRAMFILES%\INTERNET EXPLORER\IEXPLORE.EXE 
Publisher : CN=WINDOWS MAIN BUILD LAB ACCOUNT\WINDOWS® INTERNET EXPLORER\IEXPLORE.EXE,10.0.8421.0 
Hash      : SHA256 0x5F374C2DD91A6F9E9E96F149EE221EC0454649F50E1AF6D3DAEFB849FB7C551C 
AppX      : False 


PS C:\>Get-AppLockerFileInformation -Path "C:\Program Files\Internet Explorer\iexplore.exe" | Format-List
Path      : %PROGRAMFILES%\INTERNET EXPLORER\IEXPLORE.EXE 
Publisher : CN=WINDOWS MAIN BUILD LAB ACCOUNT\WINDOWS® INTERNET EXPLORER\IEXPLORE.EXE,10.0.8421.0 
Hash      : SHA256 0x5F374C2DD91A6F9E9E96F149EE221EC0454649F50E1AF6D3DAEFB849FB7C551C 
AppX      : False

This example gets the file information for the file specified by the path.

EXAMPLE 3

PS C:\>Get-AppXPackage –AllUsers | Get-AppLockerFileInformation
Path      : windows.immersivecontrolpanel_6.2.0.0_neutral_neutral_cw5n1h2txyewy.appx 
Publisher : CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, 
            C=US\windows.immersivecontrolpanel\APPX,6.2.0.0 
Hash      : 
AppX      : True 
 
Path      : windows.RemoteDesktop_1.0.0.0_neutral_neutral_cw5n1h2txyewy.appx 
Publisher : CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, 
            C=US\windows.RemoteDesktop\APPX,1.0.0.0 
Hash      : 
AppX      : True 
 
Path      : WinStore_1.0.0.0_neutral_neutral_cw5n1h2txyewy.appx 
Publisher : CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US\WinStore\APPX,1.0.0.0 
Hash      : 
AppX      : True

This example outputs the file information for all the packaged applications installed on this machine for all users.

EXAMPLE 4

PS C:\>Get-AppLockerFileInformation -EventLog -EventType Audited

This example outputs the file information for all the Audited events in the local event log. Audited events correspond to the Warning event in the AppLocker audit log.

EXAMPLE 5

PS C:\>Get-AppLockerFileInformation -EventLog -EventType Allow -Statistics

This example displays statistics for all the Allowed events in the local event log. For each file in the event log, the cmdlet will sum the number of times the event type occurred.

EXAMPLE 6

PS C:\>Get-AppLockerFileInformation -EventLog -EventType Audited | New-AppLockerPolicy -RuleType Publisher, Hash, Path -User Everyone -Optimize | Set-AppLockerPolicy -LDAP LDAP://TestGPO

This example creates a new AppLocker policy from the warning events in the local event log and sets the policy of a test Group Policy Object (GPO).

Related links

Get-AppLockerPolicy
New-AppLockerPolicy
Set-AppLockerPolicy
Test-AppLockerPolicy
Get-AppXPackage

PowerShell Support

  • Any

Operating System Support

Last edited Aug 17, 2014 at 4:55 PM by camelot, version 13

Comments

No comments yet.