

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

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

# 将 `ModifyWorkspaceCreationProperties` 与 CLI 配合使用
<a name="workspaces_example_workspaces_ModifyWorkspaceCreationProperties_section"></a>

以下代码示例演示如何使用 `ModifyWorkspaceCreationProperties`。

------
#### [ CLI ]

**AWS CLI**  
**修改目录的 WorkSpace 创建属性**  
以下 `modify-workspace-creation-properties` 示例为指定目录启用 `EnableInternetAccess` 属性。这允许为为目录 WorkSpaces 创建的自动分配公有 IP 地址。  

```
aws workspaces modify-workspace-creation-properties \
    --resource-id d-926722edaf \
    --workspace-creation-properties EnableInternetAccess=true
```
此命令不生成任何输出。  
有关更多信息，请参阅《*Amazon WorkSpaces 管理指南》 WorkSpaces*中的 “[更新您的目录详情](https://docs.aws.amazon.com/workspaces/latest/adminguide/update-directory-details.html)”。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ModifyWorkspaceCreationProperties](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/workspaces/modify-workspace-creation-properties.html)*中的。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此示例支持在创建工作空间时将互联网访问和维护模式设置为 true 作为默认值**  

```
Edit-WKSWorkspaceCreationProperty -Region us-west-2 -ResourceId d-123454a369 -WorkspaceCreationProperties_EnableInternetAccess $true -WorkspaceCreationProperties_EnableMaintenanceMode $true
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 4) [ModifyWorkspaceCreationProperties](https://docs.aws.amazon.com/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例支持在创建工作空间时将互联网访问和维护模式设置为 true 作为默认值**  

```
Edit-WKSWorkspaceCreationProperty -Region us-west-2 -ResourceId d-123454a369 -WorkspaceCreationProperties_EnableInternetAccess $true -WorkspaceCreationProperties_EnableMaintenanceMode $true
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 5) [ModifyWorkspaceCreationProperties](https://docs.aws.amazon.com/powershell/v5/reference)中的。

------