

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 一般的なユースケース
<a name="fsrm-common-use-cases"></a>

このトピックでは、一般的な File Server Resource Manager タスクのstep-by-stepの例を示します。これらの例は、FSRM 機能を使用して実装し、一般的なファイル管理の課題を解決する方法を示しています。

**注記**  
このページのすべての例では、ファイルシステムの Windows Remote PowerShell エンドポイントで ` $FSxWindowsRemotePowerShellEndpoint`変数が定義されていることを前提としています。このエンドポイントは、Amazon FSx コンソールのファイルシステムの詳細ページ、または コマンドを使用して AWS CLI `describe-file-systems`確認できます。

## フォルダにハードクォータを設定する
<a name="fsrm-setting-hard-quota"></a>

この例では、ユーザーが「department」フォルダに 10 GB 以上を保存できないようにハードクォータを作成する方法を示します。

**フォルダにクォータを設定するには:**

1. 10 GB の制限でハードクォータを作成します。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       New-FSxFSRMQuota -Folder "share\department" -Size 10GB -Description "10 GB hard limit for department folder" 
   }
   ```

1. (オプション) クォータを変更して、使用量が 85% のしきい値通知を追加します。

   ```
   $thresholds = [System.Collections.ArrayList]@() 
   $threshold = @{ 
       ThresholdPercentage = 85 
       Action = @( 
           @{ 
               ActionType = "Event" 
               EventType = "Warning" 
               MessageBody = "Department folder has reached 85% of quota limit" 
           } 
       ) 
   } 
   
   $null = $thresholds.Add($threshold) 
   
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList ($thresholds) -ScriptBlock { 
       param($thresholds) 
       Set-FSxFSRMQuota -Folder "share\department" -ThresholdConfigurations $Using:thresholds 
   }
   ```

1. クォータが作成されたことを確認します。

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

## ファイルグループを使用した特定のファイルタイプの制限
<a name="fsrm-restricting-file-types"></a>

この例では、デフォルトの`Audio and Video Files`「」ファイルグループを使用して、ユーザーがオーディオファイルとビデオファイルをビジネスドキュメントフォルダに保存することをブロックする方法を示します。

**ファイルグループを使用してファイルタイプを制限するには:**

1. オーディオファイルとビデオファイルをブロックするアクティブなファイル画面を作成します。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
   New-FSxFSRMFileScreen -Folder "share\business-documents" -IncludeGroup "Audio and Video Files" -Description "Block media files in business documents folder" 
   }
   ```

1. (オプション) ファイル画面を更新して、ユーザーがブロックされたファイルを保存しようとしたときに通知を追加します。

   ```
   $notifications = [System.Collections.ArrayList]@()
                       
   $eventNotification = @{
       ActionType = "Event"
       EventType = "Warning"
       MessageBody = "User attempted to save blocked media file"
   }
   $null = $notifications.Add($eventNotification)
   
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $notifications -ScriptBlock {
       param($notifications)
       Set-FSxFSRMFileScreen -Folder "share\business-documents" -NotificationConfigurations $Using:notifications 
   }
   ```

1. ファイル画面が作成されていることを確認します。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Get-FSxFSRMFileScreen -Folder "share\business-documents"
   }
   ```

## PII データの特定と分類
<a name="fsrm-identify-classify-pii"></a>

この例では、社会保障番号を含むファイルを自動的に識別し、個人を特定できる情報 (PII) を含むものとして分類する方法を示します。

**PII データを識別して分類するには:**

1. PII の分類プロパティを作成します。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       New-FSxFSRMClassificationPropertyDefinition -Name "ContainsPII" -Type OrderedList -PossibleValueConfigurations @(
           @{ Name = "Yes" },
           @{ Name = "No" })
   }
   ```

1. 社会保障番号を検出する分類ルールを作成します。
**注記**  
次の正規表現は、パターン XXX-XX-XXXX のテキストを検索します。本番稼働用には、より高度なパターンを使用するか、複数の検出方法を組み合わせることを検討してください。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       New-FSxFSRMClassificationRule -Name "Detect_SSN" -Property "ContainsPII" -PropertyValue "Yes" -Namespace "share" -ClassificationMechanism "Content Classifier" -ContentRegularExpression "\b\d{3}-\d{2}-\d{4}\b" 
   }
   ```

1. 実行分類:

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Start-FSxFSRMClassification
   }
   ```

1. (オプション) 新しいファイルを自動的に分類するように連続分類を設定します。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Set-FSxFSRMClassification -Continuous $true
   }
   ```

1. ステータスを確認します (1 は完了を意味します）。

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

1. 分類が完了したら、Windows File Explorer でファイルを右クリックし、プロパティを選択し、分類タブを選択することで、ファイルに割り当てられた**分類****プロパティ**を表示できます。このタブには、ファイルのすべての分類プロパティとその値が表示されます。

## ファイルの保持ポリシーの作成
<a name="fsrm-creating-retention-policy"></a>

この例では、フォルダの場所に基づいて保持期間でファイルを分類する方法を示します。このファイルは、クライアント側の PowerShell スクリプトで使用して、ファイルをアーカイブまたは削除できます。

**ファイルの保持ポリシーを作成するには:**

1. 保持期間の分類プロパティを作成します。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       New-FSxFSRMClassificationPropertyDefinition -Name "RetentionPeriod" -Type String -Description "File retention period" 
   }
   ```

1. さまざまな保持期間の分類ルールを作成します。
   + 法的文書フォルダ内の**法的文書の** 7 年間の保持:

     ```
     Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
         New-FSxFSRMClassificationRule -Name "Legal_7Year" -Property "RetentionPeriod" -PropertyValue "7 years" -Namespace "share/Legal Documents" -ClassificationMechanism "Folder Classifier" 
     }
     ```
   + **Finance** フォルダの財務記録の 3 年間の保持:

     ```
     Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
         New-FSxFSRMClassificationRule -Name "Finance_3Year" -Property "RetentionPeriod" -PropertyValue "3 years" -Namespace "share/Finance" -ClassificationMechanism "Folder Classifier" 
     }
     ```

   ファイルコンテンツで分類し、「保持期間 7 年」などの文字列を検索することもできます。これを実現するには、 `ClassificationMechanism "Content Classifier"`と を使用します`ContentString "Retention seven years"`。

1. 分類を実行して保持プロパティを適用します。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Start-FSxFSRMClassification
   }
   ```

1. (オプション) 新しいファイルを自動的に分類するように連続分類を設定します。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Set-FSxFSRMClassification -Continuous $true
   }
   ```

1. ステータスを確認します (1 は完了を意味します）。

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

1. 分類が完了したら、Windows File Explorer でファイルを右クリックし、プロパティを選択し、分類タブを選択することで、ファイルに割り当てられた**分類****プロパティ**を表示できます。このタブには、ファイルのすべての分類プロパティとその値が表示されます。

1. ファイルが保持期間で分類されたら、クライアント側の PowerShell スクリプトを使用して、`RetentionPeriod`プロパティと経過時間に基づいてファイルをアーカイブまたは削除できます。たとえば、ファイルシステムをスキャンして、ファイルの経過時間と保持期間の分類を比較できます。詳細については、「[ファイル管理タスク](fsrm-file-management.md)」を参照してください。

## 一般的なストレージレポートの設定
<a name="fsrm-setting-up-storage-reports"></a>

このセクションでは、一般的に使用される 2 つのストレージレポートを作成する方法を示します。1 つは大きなファイルレポートで、もう 1 つは所有者別レポートです。

### 大きなファイルレポート
<a name="fsrm-large-files-report"></a>

この例では、200 MB を超えるファイルを識別する月次レポートを作成します。

**大きなファイルレポートを作成するには:**

1. スケジュールされた大きなファイルレポートを作成します。

   ```
   $schedule = @{
       Time = "2:00 AM"
       Monthly = @(1) # Run on the 1st of each month
   }
   
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $schedule -ScriptBlock {
       param($schedule)
       New-FSxFSRMStorageReport -Name "Monthly Large Files Report" -Namespace "share" -ReportType "LargeFiles" -LargeFileMinimum 200MB -ReportFormat "HTML","CSV" -ScheduleConfigurations $schedule 
   }
   ```

1. (オプション) レポートをすぐに実行してテストします。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Start-FSxFSRMStorageReport -Name "Monthly Large Files Report"
   }
   ```

### 所有者別ファイルレポート
<a name="fsrm-files-by-owner-report"></a>

この例では、ユーザーごとのストレージ消費量を示す週次レポートを作成します。

**所有者レポートでファイルを作成するには:**

1. 所有者レポートでスケジュールされたファイルを作成します。

   ```
   $schedule = @{
       Time = "3:00 AM"
       Weekly = @('Sunday')
   }
   
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ArgumentList $schedule -ScriptBlock {
       param($schedule)
       New-FSxFSRMStorageReport -Name "Weekly Files by Owner Report" -Namespace "share" -ReportType "FilesByOwner" -ReportFormat "HTML","CSV" -ScheduleConfigurations $schedule 
   }
   ```

1. (オプション) レポートをすぐに実行してテストします。

   ```
   Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock {
       Start-FSxFSRMStorageReport -Name "Weekly Files by Owner Report"
   }
   ```

生成されたレポートにアクセスするには、管理 D$ 共有をマッピングします。詳細については、「[ストレージレポートへのアクセス](fsrm-storage-reports.md#fsrm-storage-reports-accessing)」を参照してください。