

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 檔案篩選
<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 可以產生通知來提醒管理員或提供資訊給使用者。您可以設定下列類型的通知：
+ **事件記錄** - 將事件記錄到 Amazon CloudWatch 或 Amazon 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>

#### New-FSxFSRMFileScreen
<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 
   }
   ```

#### Get-FSxFSRMFileScreen
<a name="get-fsxfsrmfilescreen"></a>

從檔案系統擷取一或多個檔案畫面。

 **參數：**
+ `Folder (string)` - 選用。要從中擷取檔案畫面的資料夾路徑。如果您未指定資料夾路徑，命令會傳回檔案系統上的所有檔案畫面。

 **範例**：

1. 擷取檔案系統上的所有檔案畫面。

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

#### Set-FSxFSRMFileScreen
<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 
   }
   ```

#### Remove-FSxFSRMFileScreen
<a name="remove-fsxfsrmfilescreen"></a>

從指定的資料夾移除檔案畫面。

 **參數：**
+ `Folder (string)` - 必要。要從中移除檔案畫面的資料夾路徑。
+ `PassThru (boolean)` - 選用。如果設定為 true， 會傳回移除的檔案畫面物件。

 **範例**：

1. 從特定資料夾移除檔案畫面。

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

#### Reset-FSxFSRMFileScreen
<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-FSxFSRMFileScreenTemplate
<a name="get-fsxfsrmfilescreentemplate"></a>

`Get-FSxFSRMFileScreenTemplate` 命令會從檔案系統擷取一或多個檔案畫面範本。

##### Parameters
<a name="get-fsxfsrmfilescreentemplate-parameters"></a>
+ `Name (array)` - 選用。要擷取的檔案畫面範本名稱陣列。如果您未指定名稱，命令會傳回檔案系統上的所有檔案畫面範本。

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

 1. 擷取所有檔案畫面範本。

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

#### New-FSxFSRMFileScreenTemplate
<a name="new-fsxfsrmfilescreentemplate"></a>

`New-FSxFSRMFileScreenTemplate` 命令會建立檔案畫面範本，以定義檔案畫面的可重複使用組態。範本會指定要封鎖的檔案群組，以及在使用者嘗試儲存封鎖的檔案時要產生的通知。

##### Parameters
<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`、`MostRecentlyAccessed`、 `LeastRecentlyAccessed`或 `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
}
```

#### Remove-FSxFSRMFileScreenTemplate
<a name="remove-fsxfsrmfilescreentemplate"></a>

`Remove-FSxFSRMFileScreenTemplate` 命令會從檔案系統移除一或多個檔案畫面範本。當您移除範本時，從該範本建立的檔案畫面保持不變。

##### Parameters
<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-FSxFSRMFileScreenTemplate
<a name="set-fsxfsrmfilescreentemplate"></a>

`Set-FSxFSRMFileScreenTemplate` 命令會修改現有檔案畫面範本的屬性。選擇性地更新使用修改範本建立的檔案畫面。

##### Parameters
<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>

#### New-FSxFSRMFileScreenException
<a name="new-fsxfsrmfilescreenexception"></a>

`New-FSxFSRMFileScreenException` 命令會建立檔案畫面例外狀況，覆寫任何原本會套用至資料夾及其所有子資料夾的檔案篩選規則。這允許在例外狀況資料夾中建立特定檔案類型，即使它們被父資料夾中的檔案畫面封鎖。

##### Parameters
<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-FSxFSRMFileScreenException
<a name="get-fsxfsrmfilescreenexception"></a>

`Get-FSxFSRMFileScreenException` 命令會從檔案系統擷取一或多個檔案畫面例外狀況。

##### Parameters
<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"
}
```

#### Remove-FSxFSRMFileScreenException
<a name="remove-fsxfsrmfilescreenexception"></a>

`Remove-FSxFSRMFileScreenException` 命令會從指定的資料夾移除檔案畫面例外狀況。移除後，資料夾及其子資料夾將受到先前被例外狀況覆寫之父資料夾的任何檔案篩選規則的約束。

##### Parameters
<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-FSxFSRMFileScreenException
<a name="set-fsxfsrmfilescreenexception"></a>

`Set-FSxFSRMFileScreenException` 命令會修改檔案畫面例外狀況的屬性。

##### Parameters
<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 
}
```