View a markdown version of this page

文件筛选 - 适用于 Windows File Server 的 Amazon FSx
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)。

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

文件筛选

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

注意

文件屏幕使用文件组来定义要阻止或监视的文件类型。有关创建和管理文件组的更多信息,请参阅文件组。

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

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

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

文件屏幕模板

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

使用文件屏幕模板有几个好处:

  • 一致性 -确保相似的文件夹具有相同的文件筛选配置

  • 效率 -快速将文件筛选设置应用到多个文件夹

  • 可维护性 -通过修改模板更新多个文件夹的文件筛选设置

文件屏幕异常

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

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

文件筛选通知

当用户尝试保存被活动文件屏幕阻止的文件时,FSRM 可以生成通知以提醒管理员或向用户提供信息。您可以配置以下类型的通知:

  • 事件记录 -将事件记录到亚马逊 CloudWatch 或亚马逊 Kinesis Data Firehose 进行监控和分析。您可以指定事件的严重性级别(信息、警告或错误)并提供自定义消息正文。事件记录对于跟踪文件屏幕违规行为以及与现有监控系统集成非常有用。

  • 存储报告 -生成存储使用情况报告,提供有关文件筛选活动的详细信息。存储报告可帮助您识别文件保存尝试的模式,并就文件筛选策略做出明智的决定。有关更多信息,请参阅 存储报告。

文件筛选管理命令

您可以访问三组 FSx 远程 PowerShell 命令来管理文件屏幕:

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

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

  3. 文件屏幕例外命令 -创建、检索、修改和删除覆盖父文件夹中文件筛选规则的文件屏幕例外。当您需要允许特定子文件夹中的特定文件类型同时保持更广泛的限制时,请使用这些命令。

文件屏蔽 FSx 远程 PowerShell 命令列表

注意

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

文件屏幕命令

New-FSxFSRMFileScreen

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

参数:

  • Folder (string) – 必需。将应用文件屏幕的文件夹路径。

  • Description (string) – 可选。文件屏幕的描述。

  • IncludeGroup (array) – 可选。一个文件组名称数组,用于指定要阻止或监视哪些文件。

  • Active (boolean) – 可选。如果设置为 true,则创建一个阻止文件的活动文件屏幕。如果设置为 false,则创建一个仅监视文件的被动文件屏幕。默认设置为 true。

  • Template (string) – 可选。要使用的现有文件屏幕模板的名称。

  • NotificationConfigurations (array) – 可选。一组用于在用户尝试保存被阻止文件时发出通知的配置。每种配置都有以下属性:

    • ActionType (string):要执行的操作类型。可以指定以下值:

      1. Event:将事件记录到文件系统的事件日志中。在指定 Event 时,还必须指定以下属性:

        • EventType (string): 信息、警告或错误

        • MessageBody (string):要记录事件的消息文本。

      2. Report:生成存储使用情况报告。当您指定 “报告” 时,还必须指定:

        • ReportType (string):报告的类型。您可以指定以下值:DuplicateFiles、、FilesByFileGroup、FilesByOwner、FilesByPropertyLargeFiles、LeastRecentlyAccessed、MostRecentlyAccessed、或QuotaUsage。

示例:

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

    Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock { New-FSxFSRMFileScreen -Folder "share\department" -IncludeGroup "Audio and Video Files" }
  2. 创建一个文件屏幕,在用户尝试保存视频文件时阻止视频文件并生成事件日志条目。

    $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

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

参数:

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

示例:

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

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

Set-FSxFSRMFileScreen

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

参数:

  • 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 }
  2. 将文件屏幕设置为活动模式并添加通知。

    $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

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

参数:

  • Folder (string) – 必需。从中移除文件屏幕的文件夹路径。

  • PassThru (boolean) – 可选。如果设置为 true,则返回移除的文件屏幕对象。

示例:

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

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

Reset-FSxFSRMFileScreen

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

参数:

  • Folder (string) – 必需。包含要重置的文件屏幕的文件夹路径。

  • Template (string) – 必需。要应用的现有文件屏幕模板的名称。

示例:

  1. 重置文件屏幕以匹配文件屏幕模板中定义的设置。

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

文件屏幕模板命令

Get-FSxFSRMFileScreenTemplate

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

参数
  • Name (array) – 可选。要检索的文件屏幕模板的名称数组。如果您未指定名称,则该命令将返回文件系统上的所有文件屏幕模板。

示例

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

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

New-FSxFSRMFileScreenTemplate

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

参数
  • Name (string) – 必需。文件屏幕模板的名称。

  • Description (string) – 可选。文件屏幕模板的描述。

  • IncludeGroup (array) – 可选。一个文件组名称数组,用于指定要阻止或监视哪些文件。

  • Active (boolean) – 可选。如果设置为 true,则创建一个阻止文件的活动文件屏幕模板。如果设置为 false,则创建一个仅监视文件的被动模板。默认设置为 true。

  • NotificationConfigurations (array) – 可选。一组用于在用户尝试保存被阻止文件时发出通知的配置。每种配置都有以下属性:

    • ActionType (string):要执行的操作类型。可以指定以下值:

      1. Event:将事件记录到文件系统的事件日志中。在指定 Event 时,还必须指定以下属性:

        • EventType (string): 信息、警告或错误

        • MessageBody (string):要记录事件的消息文本。

      2. Report:生成存储使用情况报告。在指定 “报告” 时,还必须指定:

        • ReportType (string):报告的类型。您可以指定以下值:DuplicateFiles、、FilesByFileGroup、FilesByOwner、FilesByPropertyLargeFiles、LeastRecentlyAccessed、MostRecentlyAccessed、或 QuotaUsage

示例

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

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

参数
  • Name (array) – 必需。要删除的文件屏幕模板的名称数组。

  • PassThru (boolean) – 可选。如果设置为 true,则返回移除的文件屏幕模板对象。

示例

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

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

Set-FSxFSRMFileScreenTemplate

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

参数
  • Name (array) – 必需。要修改的文件屏幕模板的名称数组。

  • Description (string) – 可选。模板的新描述。

  • IncludeGroup (array) – 可选。一个新的文件组名称数组,用于定义要阻止或监视哪些文件。

  • Active (boolean) – 可选。如果设置为 true,则将模板设置为活动模式(阻塞)。如果设置为 false,则将模板设置为被动模式(监视)。默认设置为 true。

  • NotificationConfigurations (array) – 可选。一组新的通知配置。

  • UpdateDerived (boolean) – 可选。如果设置为 true,则更新根据此模板创建的所有现有文件屏幕,无论对这些文件屏幕进行了何种修改。

  • UpdateDerivedMatching (boolean) – 可选。如果设置为 true,则仅更新自从使用此模板创建以来未修改过的文件屏幕。

  • PassThru (boolean) – 可选。如果设置为 true,则返回修改后的文件屏幕模板对象。

示例

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 }

文件屏幕异常命令

New-FSxFSRMFileScreenException

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

参数
  • Folder (string) – 必需。将应用文件屏幕异常的文件夹路径。例外情况适用于此文件夹及其所有子文件夹。

  • Description (string) – 可选。文件屏幕异常的描述。

  • IncludeGroup (array) – 可选。一个文件组名称数组,用于指定尽管存在任何阻塞文件屏幕(本应从父文件夹生效)仍允许哪些文件。

示例

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

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

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

示例

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

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

参数
  • Folder (string) – 必需。要从中删除文件屏幕异常的文件夹路径。

  • PassThru (boolean) – 可选。如果设置为 true,则返回移除的文件屏幕异常对象。

示例

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

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

Set-FSxFSRMFileScreenException

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

参数
  • Folder (string) – 必需。包含要修改的文件屏幕异常的文件夹路径。

  • Description (string) – 可选。文件屏幕异常的新描述。

  • IncludeGroup (array) – 可选。一个新的文件组名称数组,用于定义尽管存在任何阻塞文件屏幕(原本应用于父文件夹),但仍允许哪些文件。

  • PassThru (boolean) – 可选。如果设置为 true,则返回修改后的文件屏幕异常对象。

示例

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 }