UiPath Documentation
activities
latest
false
IT 自动化活动
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

配置和管理 Amazon WorkSpaces

配置和管理 Amazon WorkSpaces 实例,包括工作区创建、重新启动计划、为节省成本而停止和删除。

下面的示例说明了如何使用 Amazon WorkSpaces 活动来自动执行配置和成本节省任务。它会显示Amazon Workspaces 作用域创建工作区遍历工作区重新启动工作区停止工作区更新工作区删除工作区等活动。您可以在“UiPath.AmazonWorkSpaces.Activities ”包中找到这些活动。

该示例包含两个工作流:

Create_Workspace.xaml

通过以下方式为给定目录用户配置新的 WorkSpace:

  • 准备要与 WorkSpace 关联的标签,包括键为CreationDate的标签,以存储创建日期信息,因为 Amazon WorkSpaces API 不提供此值;
  • 指定捆绑包、目录、用户名、运行模式、标签等。

Manage_Workspaces.xaml

通过以下方式为指定目录中的 WorkSpaces 执行 IT 管理任务:

  • 识别并重新启动运行状况不佳的 WorkSpace;
  • 停止可用但处于断开连接状态的 WorkSpaces (成本优化);
  • 识别未使用的 WorkSpace,并根据非活动期采取以下操作之一:
    • 向用户发送警告电子邮件;
    • 永久删除 WorkSpace (成本优化)。

配置 WorkSpace

This is how the first automation process, Create_Workspace.xaml, which connects to Amazon Web Services and creates a new WorkSpace, can be built:

  1. Add the Amazon Workspace Scope activity to connect to Amazon Web Services and also to provide a scope for the Amazon WorkSpaces activities. Then specify either Access Keys (i.e., AccessKeyId & SecretAccessKey) or an IAMRole (when the robot is running within an EC2 instance). In this example, we are connecting using Access Keys.

    备注:

    有关创建 AWS 密钥的更多详细信息,请阅读此文:创建 AWS 访问密钥

  2. A new WorkSpace is provisioned using the Create Workspace activity.

管理 WorkSpaces

This is how the second automation process, Manage_Workspaces.xaml, which retrieves all WorkSpaces in a specified directory, can be built:

  1. 请按照配置 WorkSpace中步骤 1 中的相同说明进行操作。

  2. Use the For Each Workspace activity with FilterBy set to DirectoryId. Then provide your directory ID in the FilterValue property.

    备注:

    The For Each Workspace activity supports filtering by DirectoryId, BundleId, and WorkspaceIds.

对于与筛选条件匹配的每个 WorkSpace,我们检查是否应执行以下操作之一。

重新启动运行状况不佳的 WorkSpace

If the state of the WorkSpace is AWRKSState.UNHEALTHY, reboot the WorkSpace by using the Reboot Workspace activity.

Since this activity can take a long time, it is recommended to set the value of the WaitForCompletion property to False.

停止已断开连接的 WorkSpace

停止断开连接超过 30 分钟的 WorkSpace。

If the running mode of the WorkSpace is AutoStop and the user is disconnected for more than MinutesSinceDisconnected minutes, stop it by calling the Stop Workspace activity with WaitForCompletion set to False.

发送警告电子邮件

如果 WorkSpace 在过去 30 天内未使用过,则向用户发送警告电子邮件。

如果在过去 InactivityPeriodBeforeWarning 天内未使用 WorkSpace,用户将收到一封电子邮件,说明将在 7 天内永久删除该 WorkSpace,即 InactivityPeriodBeforeRemoving - InactivityPeriodBeforeWarning = 37 – 30 = 7

Use the Send Outlook Mail Message activity to send the warning email.

In addition, to keep a record of the admin action performed, add a tag/tags to the WorkSpace. Use the Update Workspace activity to add such tags.

永久删除 WorkSpace

删除过去 37 天内未使用的 WorkSpace。

If the WorkSpace was not used in the past InactivityPeriodBeforeRemoving days, it will be terminated. For this action, use the Remove Workspace activity with WaitForCompletion set to False.

永久删除从未使用过的 WorkSpace

删除自创建超过 37 天以来从未使用过的 WorkSpace。

仅当 WorkSpace.LastKnownUserConnectionTimestamp = new DateTime() (即 从未使用过),并且 WorkSpace 具有存储创建日期的标签(因为 Amazon WorkSpaces API 不提供此值)。

如果 WorkSpace 从未使用过且为 creationDate <= Today.Date.AddDays(-InactivityPeriodBeforeRemoving),则它将被永久删除。

Run the process. The robot uses the Amazon WorkSpaces activities to automate your Amazon WorkSpaces tasks.

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新