

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

# 使用 Amazon FSx CLI 进行远程管理的一次性文件系统设置任务 PowerShell
<a name="one-time-admin-tasks"></a>

在 PowerShell命令上使用以下 Amazon FSx CLI 进行远程管理，按照我们的最佳实践快速实施文件系统管理任务。

## 管理存储消耗量
<a name="manage-disk-usage"></a>

使用以下命令来管理文件系统的存储消耗量。
+ 要按默认计划开启重复数据删除，请运行以下命令。

  ```
  Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock { Enable-FsxDedup }
  ```

  或者，使用以下命令在文件创建后立即对文件执行重复数据删除操作，无需任何最短文件期限。

  ```
  Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock { Set-FSxDedupConfiguration -MinimumFileAgeDays 0 }
  ```

  有关更多信息，请参阅 [通过重复数据删除来降低存储成本](managing-storage-configuration.md#using-data-dedup)。

   
+ 使用以下命令开启“跟踪”模式下的用户存储限额，该模式仅用于报告目的，不用于强制执行。

  ```
  $QuotaLimit = Quota limit in bytes
  $QuotaWarningLimit = Quota warning threshold in bytes
  Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock { Enable-FSxUserQuotas -Track -DefaultLimit $Using:QuotaLimit -DefaultWarningLimit $Using:QuotaWarningLimit }
  ```

  有关更多信息，请参阅 [管理存储配额](managing-user-quotas.md)。

## 启用影子副本，使最终用户能够将文件和文件夹恢复到以前的版本
<a name="turn-on-shadow-copies"></a>

按照默认时间表（工作日上午 7 点和中午 12 点）开启影子副本，如下所示。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock { Set-FsxShadowStorage -Default }
     
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock { Set-FsxShadowCopySchedule -Default -Confirm:$False}
```

有关更多信息，请参阅 [配置影子副本使用默认存储和计划](setting-up-fsx-shadow-copies.md)。

## 在传输过程中强制加密
<a name="admin-encryption"></a>

以下命令对连接到您的文件系统的客户端强制加密。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock { Set-FsxSmbServerConfiguration -EncryptData $True -RejectUnencryptedAccess $True -Confirm:$False}
```

您可以关闭所有打开的会话，并强制当前连接的客户端使用加密重新连接。

```
Invoke-Command -ComputerName $FSxWindowsRemotePowerShellEndpoint -ConfigurationName FSxRemoteAdmin -ScriptBlock { Close-FSxSmbSession -Confirm:$False}
```

有关更多信息，请参阅[管理传输中加密](encryption-in-transit.md#manage-encrypt-in-transit)和[用户会话和打开的文件](manage-sessions-and-files.md)。