

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 文件筛选
<a name="fsrm-file-screening"></a>

文件筛选控制用户可以将哪些类型的文件保存到文件系统的文件夹中。文件筛选可帮助您强制执行存储策略，防止未经授权的文件类型，并保持对组织要求的合规性。

**注意**  
文件屏幕使用文件组来定义要屏蔽或监视哪些文件类型。有关创建和管理文件组的更多信息，请参阅[文件组](fsrm-file-groups.md)。

FSRM 支持两种类型的文件屏幕：

1. **活动文件屏幕**-阻止用户保存与指定文件组匹配的文件，并在用户尝试保存被阻止的文件时生成通知。当您需要对特定文件夹中允许哪些文件类型实施严格政策时，请使用活动文件屏幕。

1. **被动文件屏幕**-在用户保存与指定文件组匹配的文件时进行监控和记录，但不阻止保存操作。如果您想在不中断用户工作流程的情况下跟踪文件使用模式，请使用被动文件屏幕。

## 文件屏幕模板
<a name="fsrm-file-screen-templates"></a>

文件屏幕模板提供了可重复使用的配置，用于定义文件筛选设置，包括要屏蔽或监控哪些文件组以及要生成哪些通知。创建文件屏幕模板后，可以将其应用于多个文件夹，而不必每次都重新配置相同的设置。更新文件屏幕模板时，可以选择将更改应用于根据该模板创建的所有文件屏幕。

使用文件屏幕模板有以下几个好处：
+ **一致性**-确保相似的文件夹具有相同的文件筛选配置
+ **效率**-将文件筛选设置快速应用于多个文件夹
+ **可维护性**-通过修改模板来更新多个文件夹中的文件筛选设置

## 文件屏幕异常
<a name="fsrm-file-screen-exceptions"></a>

文件屏幕例外会覆盖原本适用于文件夹及其所有子文件夹的文件筛选规则。创建文件屏幕异常时，您可以指定允许哪些文件组，尽管父文件夹中存在任何屏蔽文件屏幕。当您需要允许在某些子文件夹中使用特定的文件类型，同时在文件夹层次结构的更高级别上保持更广泛的限制时，文件屏幕例外非常有用。

例如，您可以屏蔽整个共享中的可执行文件，但会为管理员需要在其中存储安装文件的特定子文件夹创建一个例外。

## 文件筛选通知
<a name="fsrm-file-screening-notifications"></a>

当用户尝试保存被活动文件屏幕屏蔽的文件时，FSRM 可以生成通知，提醒管理员或向用户提供信息。您可以配置以下类型的通知：
+ **事件记录-将事件记录**到亚马逊 CloudWatch 或亚马逊 Kinesis Data Firehose 以进行监控和分析。您可以指定事件的严重性级别（信息、警告或错误），并提供自定义消息正文。事件记录对于跟踪文件屏幕违规行为以及与现有监控系统集成非常有用。
+ **存储报告**-生成存储使用情况报告，提供有关文件筛选活动的详细信息。存储报告可帮助您识别文件保存尝试中的模式，并就文件筛选策略做出明智的决定。有关更多信息，请参阅 [存储报告](fsrm-storage-reports.md)。

## 文件筛选管理命令
<a name="fsrm-file-screening-management-commands"></a>

您可以访问三个系列的 FSx 远程 PowerShell 命令来管理文件屏幕：

1. **文件屏幕命令**-在特定文件夹上创建、检索、修改、删除和重置单个文件屏幕。当您需要 folder-by-folder逐一管理文件屏幕时，请使用这些命令。

1. **文件屏幕模板命令**-创建、检索、修改和删除定义可重复使用的文件筛选配置的文件屏幕模板。使用这些命令来建立可以应用于多个文件夹的标准文件筛选策略。

1. **文件屏幕异常命令**-创建、检索、修改和删除会覆盖父文件夹中文件筛选规则的文件屏幕异常。如果您需要允许某些子文件夹中的特定文件类型，同时保持更广泛的限制，请使用这些命令。

### 文件筛选 FSx 远程 PowerShell 命令列表
<a name="fsrm-file-screening-powershell-commands"></a>

**注意**  
本页中的所有示例都假设您已经使用文件系统的 Windows Remote PowerShell 端点定义了该` $FSxWindowsRemotePowerShellEndpoint`变量。您可以在文件系统的详细信息页面上的 Amazon FSx 控制台中找到此终端节点，也可以使用 AWS CLI `describe-file-systems`命令找到此终端节点。

### 文件屏幕命令
<a name="fsrm-file-screen-commands"></a>

#### 全新-FSx FSRMFile 屏幕
<a name="new-fsxfsrmfilescreen"></a>

创建文件屏幕，阻止用户将指定类型的文件保存到文件夹。

 **参数：**
+ `Folder (string)` – 必需。将应用文件屏幕的文件夹路径。
+ `Description (string)` – 可选。文件屏幕的描述。
+ `IncludeGroup (array)` – 可选。文件组名称数组，用于指定要阻止或监视哪些文件。
+ `Active (boolean)` – 可选。如果设置为 true，则会创建一个屏蔽文件的活动文件屏幕。如果设置为 false，则会创建一个仅监视文件的被动文件屏幕。默认设置为 true。
+ `Template (string)` – 可选。要使用的现有文件屏幕模板的名称。
+ `NotificationConfigurations (array)` – 可选。一系列配置，用于在用户尝试保存被阻止的文件时发出通知。每种配置都具有以下属性：
  + `ActionType (string)`：要执行的操作类型。可以指定以下值：

    1. `Event`：将事件记录到文件系统的事件日志。指定 “事件” 时，还必须指定以下属性：
       + `EventType (string)`: 信息、警告或错误
       + `MessageBody (string)`：要与事件一起记录的消息文本。

    1. `Report`：生成存储使用情况报告。指定 “报告” 时，还必须指定：
       + `ReportType (string)`：报告的类型。您可以指定以下值：`DuplicateFiles`、`FilesByFileGroup`、`FilesByOwner`、`FilesByProperty`、`LargeFiles`、`LeastRecentlyAccessed``MostRecentlyAccessed`、或`QuotaUsage`。

 **示例：**

1. 创建一个屏蔽音频文件的基本活动文件屏幕。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       New-FSxFSRMFileScreen -Folder "share\department" -IncludeGroup "Audio and Video Files"
   }
   ```

1. 创建一个文件屏幕，用于屏蔽视频文件，并在用户尝试保存视频文件时生成事件日志条目。

   ```
   $notifications = [System.Collections.ArrayList]@()
   $eventNotification = @{
       ActionType = "Event"
       EventType = "Warning"
       MessageBody = "File screen violation detected"
   }
   $null = $notifications.Add($eventNotification)
   
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $notifications -ScriptBlock {
       param($notifications)
       New-FSxFSRMFileScreen -Folder "share\projects" -IncludeGroup "Audio and Video Files" -NotificationConfigurations $Using:notifications 
   }
   ```

#### 获取-FSx FSRMFile 屏幕
<a name="get-fsxfsrmfilescreen"></a>

从您的文件系统中检索一个或多个文件屏幕。

 **参数：**
+ `Folder (string)` – 可选。从中检索文件的文件夹路径。如果您未指定文件夹路径，则该命令将返回文件系统上的所有文件屏幕。

 **示例：**

1. 检索文件系统上的所有文件屏幕。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Get-FSxFSRMFileScreen
   }
   ```

#### 设置-FSx FSRMFile 屏幕
<a name="set-fsxfsrmfilescreen"></a>

修改现有文件屏幕的属性。

 **参数：**
+ `Folder (string)` – 必需。包含要修改的文件屏幕的文件夹路径。
+ `Description (string)` – 可选。文件屏幕的新描述。
+ `IncludeGroup (array)` – 可选。一个新的文件组名称数组，用于定义要阻止或监视哪些文件。
+ `Active (boolean)` – 可选。如果设置为 true，则将文件屏幕设置为活动模式（屏蔽）。如果设置为 false，则将文件屏幕设置为被动模式（仅限监控）。默认设置为 true。
+ `NotificationConfigurations (array)` – 可选。一系列新的通知配置。
+ `PassThru (boolean)` – 可选。如果设置为 true，则返回修改后的文件屏幕对象。

 **示例：**

1. 修改文件屏幕的描述和文件组。

   ```
   $includeGroups = @("Audio and Video Files")
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $includeGroups -ScriptBlock {
       param($includeGroups)
       Set-FSxFSRMFileScreen -Folder "share\projects" -Description "Updated screen" -IncludeGroup $includeGroups 
   }
   ```

1. 将文件屏幕设置为活动模式并添加通知。

   ```
   $notifications = [System.Collections.ArrayList]@()
   $eventNotification = @{
       ActionType = "Event"
       EventType = "Warning"
       MessageBody = "File screen violation detected"
   }
   $null = $notifications.Add($eventNotification)
   
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $notifications -ScriptBlock {
       param($notifications)
       Set-FSxFSRMFileScreen -Folder "share\projects" -Active: $true -NotificationConfigurations $Using:notifications -PassThru 
   }
   ```

#### 移除-FSx FSRMFile 屏幕
<a name="remove-fsxfsrmfilescreen"></a>

从指定文件夹中移除文件屏幕。

 **参数：**
+ `Folder (string)` – 必需。要从中删除文件屏幕的文件夹路径。
+ `PassThru (boolean)` – 可选。如果设置为 true，则返回已删除的文件屏幕对象。

 **示例：**

1. 从特定文件夹中移除文件屏幕。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Remove-FSxFSRMFileScreen -Folder "share\projects" -PassThru 
   }
   ```

#### 重置-FSx FSRMFile 屏幕
<a name="reset-fsxfsrmfilescreen"></a>

重置文件屏幕以匹配指定模板的设置。

 **参数：**
+ `Folder (string)` – 必需。包含要重置的文件屏幕的文件夹路径。
+ `Template (string)` – 必需。要应用的现有文件屏幕模板的名称。

 **示例：**

1. 重置文件屏幕，使其与文件屏幕模板中定义的设置相匹配。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Reset-FSxFSRMFileScreen -Folder "share\department" -Template "Block Audio Files" 
   }
   ```

### 文件屏幕模板命令
<a name="file-screen-template-commands"></a>

#### Get-FSx FSRMFile ScreenTemplate
<a name="get-fsxfsrmfilescreentemplate"></a>

该`Get-FSxFSRMFileScreenTemplate`命令会从您的文件系统中检索一个或多个文件屏幕模板。

##### 参数
<a name="get-fsxfsrmfilescreentemplate-parameters"></a>
+ `Name (array)` – 可选。要检索的文件屏幕模板的名称数组。如果您未指定名称，则该命令将返回文件系统上的所有文件屏幕模板。

##### 示例
<a name="get-fsxfsrmfilescreentemplate-examples"></a>

 1. 检索所有文件屏幕模板。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
    Get-FSxFSRMFileScreenTemplate
}
```

#### 全新-FSx FSRMFile ScreenTemplate
<a name="new-fsxfsrmfilescreentemplate"></a>

该`New-FSxFSRMFileScreenTemplate`命令创建一个文件屏幕模板，该模板为文件屏幕定义了可重复使用的配置。该模板指定要阻止哪些文件组，以及在用户尝试保存被阻止的文件时生成哪些通知。

##### 参数
<a name="new-fsxfsrmfilescreentemplate-parameters"></a>
+ `Name (string)` – 必需。文件屏幕模板的名称。
+ `Description (string)` – 可选。文件屏幕模板的描述。
+ `IncludeGroup (array)` – 可选。文件组名称数组，用于指定要阻止或监视哪些文件。
+ `Active (boolean)` – 可选。如果设置为 true，则创建用于屏蔽文件的活动文件屏幕模板。如果设置为 false，则创建仅监视文件的被动模板。默认设置为 true。
+ `NotificationConfigurations (array)` – 可选。一系列配置，用于在用户尝试保存被阻止的文件时发出通知。每种配置都具有以下属性：
  + `ActionType (string)`：要执行的操作类型。可以指定以下值：

    1. `Event`：将事件记录到文件系统的事件日志。指定 “事件” 时，还必须指定以下属性：
       + `EventType (string)`: 信息、警告或错误
       + `MessageBody (string)`：要与事件一起记录的消息文本。

    1. `Report`：生成存储使用情况报告。指定 “报告” 时，还必须指定：
       + `ReportType (string)`：报告的类型。您可以指定以下值：`DuplicateFiles`、`FilesByFileGroup`、`FilesByOwner`、`FilesByProperty`、`LargeFiles``LeastRecentlyAccessed`、`MostRecentlyAccessed`、或 `QuotaUsage` 

##### 示例
<a name="new-fsxfsrmfilescreentemplate-examples"></a>

 1. 创建带有通知的文件屏幕模板。

```
$notifications = [System.Collections.ArrayList]@()
$eventNotif = @{
    ActionType = "Event"
    EventType = "Warning"
    MessageBody = "Blocked file detected"
}
$null = $notifications.Add($eventNotif)

Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $notifications -ScriptBlock {
    param($notifications)
    New-FSxFSRMFileScreenTemplate -Name "Block Executables" -Description "Blocks executable files" -IncludeGroup "Executable Files" -Active: $true -NotificationConfigurations $Using:notifications
}
```

#### 移除-FSx FSRMFile ScreenTemplate
<a name="remove-fsxfsrmfilescreentemplate"></a>

该`Remove-FSxFSRMFileScreenTemplate`命令将从您的文件系统中移除一个或多个文件屏幕模板。移除模板时，根据该模板创建的文件屏幕将保持不变。

##### 参数
<a name="remove-fsxfsrmfilescreentemplate-parameters"></a>
+ `Name (array)` – 必需。要删除的文件屏幕模板的名称数组。
+ `PassThru (boolean)` – 可选。如果设置为 true，则返回已删除的文件屏幕模板对象。

##### 示例
<a name="remove-fsxfsrmfilescreentemplate-examples"></a>

 1. 移除单个文件屏幕模板。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
    Remove-FSxFSRMFileScreenTemplate -Name "Block Executables" -PassThru 
}
```

#### Set-FSx FSRMFile ScreenTemplate
<a name="set-fsxfsrmfilescreentemplate"></a>

该`Set-FSxFSRMFileScreenTemplate`命令修改现有文件屏幕模板的属性。（可选）更新使用修改后的模板创建的文件屏幕。

##### 参数
<a name="set-fsxfsrmfilescreentemplate-parameters"></a>
+ `Name (array)` – 必需。要修改的文件屏幕模板的名称数组。
+ `Description (string)` – 可选。模板的新描述。
+ `IncludeGroup (array)` – 可选。一个新的文件组名称数组，用于定义要阻止或监视哪些文件。
+ `Active (boolean)` – 可选。如果设置为 true，则将模板设置为活动模式（阻止）。如果设置为 false，则将模板设置为被动模式（监控）。默认设置为 true。
+ `NotificationConfigurations (array)` – 可选。一系列新的通知配置。
+ `UpdateDerived (boolean)` – 可选。如果设置为 true，则更新根据此模板创建的所有现有文件屏幕，无论对这些文件屏幕进行了何种修改。
+ `UpdateDerivedMatching (boolean)` – 可选。如果设置为 true，则仅更新自该模板创建以来未修改过的文件屏幕。
+ `PassThru (boolean)` – 可选。如果设置为 true，则返回修改后的文件屏幕模板对象。

##### 示例
<a name="set-fsxfsrmfilescreentemplate-examples"></a>

 1. 使用新的文件组更新文件屏幕模板。

```
$includeGroups = @("Audio and Video Files")
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $includeGroups -ScriptBlock {
    param($includeGroups)
    Set-FSxFSRMFileScreenTemplate -Name "Block Executables" -IncludeGroup $includeGroups 
}
```

 2. 将文件屏幕模板更新为活动模式并更新所有派生的文件屏幕。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
    Set-FSxFSRMFileScreenTemplate -Name "Block Executables" -Active: $true -UpdateDerived 
}
```

### 文件屏幕异常命令
<a name="file-screen-exception-commands"></a>

#### 全新-FSx FSRMFile ScreenException
<a name="new-fsxfsrmfilescreenexception"></a>

该`New-FSxFSRMFileScreenException`命令会创建一个文件屏幕异常，该例外会覆盖原本适用于文件夹及其所有子文件夹的所有文件筛选规则。这允许在异常文件夹中创建特定的文件类型，即使它们被父文件夹中的文件屏幕屏蔽也是如此。

##### 参数
<a name="new-fsxfsrmfilescreenexception-parameters"></a>
+ `Folder (string)` – 必需。将应用文件屏幕异常的文件夹路径。例外情况适用于此文件夹及其所有子文件夹。
+ `Description (string)` – 可选。文件屏幕异常的描述。
+ `IncludeGroup (array)` – 可选。一组文件组名称，用于指定允许哪些文件，尽管存在任何屏蔽文件屏幕，否则这些屏幕会从父文件夹中应用。

##### 示例
<a name="new-fsxfsrmfilescreenexception-examples"></a>

 1. 为特定文件夹和文件组创建文件屏幕例外。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
    New-FSxFSRMFileScreenException -Folder "share\department" -IncludeGroup "Text Files" 
}
```

 2. 创建包含多个文件组的文件屏幕异常。

```
$includeGroups = @("Audio and Video Files", "Documents")
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $includeGroups -ScriptBlock {
    param($includeGroups)
    New-FSxFSRMFileScreenException -Folder "share\projects" -Description "Allow media files in project folder" -IncludeGroup $includeGroups 
    }
```

#### Get-FSx FSRMFile ScreenException
<a name="get-fsxfsrmfilescreenexception"></a>

该`Get-FSxFSRMFileScreenException`命令会从您的文件系统中检索一个或多个文件屏幕异常。

##### 参数
<a name="get-fsxfsrmfilescreenexception-parameters"></a>
+ `Folder (string)` – 可选。从中检索文件屏幕异常的文件夹路径。如果您未指定文件夹路径，则该命令将返回文件系统上的所有文件屏幕异常。

##### 示例
<a name="get-fsxfsrmfilescreenexception-examples"></a>

 1. 检索文件系统上的所有文件屏幕异常。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
    Get-FSxFSRMFileScreenException
}
```

 2. 检索特定文件夹的文件屏幕异常。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
    Get-FSxFSRMFileScreenException -Folder "share\department"
}
```

#### 移除-FSx FSRMFile ScreenException
<a name="remove-fsxfsrmfilescreenexception"></a>

该`Remove-FSxFSRMFileScreenException`命令从指定文件夹中删除文件屏幕异常。删除后，该文件夹及其子文件夹将受以前被例外覆盖的父文件夹中所有文件筛选规则的约束。

##### 参数
<a name="remove-fsxfsrmfilescreenexception-parameters"></a>
+ `Folder (string)` – 必需。要从中删除文件屏幕异常的文件夹路径。
+ `PassThru (boolean)` – 可选。如果设置为 true，则返回已删除的文件屏幕异常对象。

##### 示例
<a name="remove-fsxfsrmfilescreenexception-examples"></a>

 1. 从特定文件夹中移除文件屏幕异常。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
    Remove-FSxFSRMFileScreenException -Folder "share\projects" -PassThru 
}
```

#### Set-FSx FSRMFile ScreenException
<a name="set-fsxfsrmfilescreenexception"></a>

该`Set-FSxFSRMFileScreenException`命令修改文件屏幕异常的属性。

##### 参数
<a name="set-fsxfsrmfilescreenexception-parameters"></a>
+ `Folder (string)` – 必需。包含要修改的文件屏幕异常的文件夹路径。
+ `Description (string)` – 可选。文件屏幕异常的新描述。
+ `IncludeGroup (array)` – 可选。一个新的文件组名称数组，用于定义允许哪些文件，尽管存在任何屏蔽文件屏幕，否则这些屏幕会从父文件夹中应用。
+ `PassThru (boolean)` – 可选。如果设置为 true，则返回修改后的文件屏幕异常对象。

##### 示例
<a name="set-fsxfsrmfilescreenexception-examples"></a>

 1. 针对文件屏幕异常更新允许的文件组。

```
$includeGroups = @("Audio and Video Files")
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $includeGroups -ScriptBlock {
    param($includeGroups)
    Set-FSxFSRMFileScreenException -Folder "share\projects" -IncludeGroup $includeGroups -PassThru 
}
```