UiPath Documentation
uipath-cli
latest
false
UiPath CLI 用户指南
重要 :
请注意,此内容已使用机器翻译进行了本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

UIP 或会话

“uip 或会话”的语法和选项,用于查看和管理机器人与 Orchestrator 的实时连接。

uip or sessions查看和管理 Orchestrator 会话 — 机器人(Attended 和 Unattended)与 Orchestrator 之间的实时主机连接。使用它来查看已连接的主机,检查 runtime 插槽的使用情况,切换会话的调试模式,将会话置于维护状态,或清理非活动会话。

大纲

uip or sessions <verb> [options]
uip or sessions <verb> [options]

动词

动词用途
attended list列出租户中或文件夹范围内的 Attended (Studio/Assistant) 会话。
machines list按计算机密钥列出特定计算机的会话。
list-usernames列出拥有活动会话的用户的用户名。
unattended list列出 Unattended 会话运行时(跨计算机的插槽使用情况)。
list-user-executors列出按用户名分组的自动化执行程序(机器人名称)。
toggle-debug-mode在计算机会话中启用或禁用调试模式。
delete-inactive删除断开连接或无响应的会话(全部会话或按 ID 删除)。
set-maintenance-mode将计算机会话置于维护模式。

所有动词都遵循全局选项--output--output-filter--log-level--log-file )。退出代码遵循标准合同

uip or sessions attended list

列出有人值守的会话 — Studio 和 Assistant 连接。如果不带文件夹标志,则返回所有文件夹中的会话(全局视图)。使用--folder-key--folder-path将返回限定在文件夹范围内的会话。

选项

默认描述
--folder-keyGUID文件夹范围内列表的文件夹键。
--folder-path路径文件夹路径(例如Shared )。
--state枚举AvailableBusyDisconnectedUnknown 。如果未设置--state ,将排除Disconnected会话。
--machine-nametext计算机名称的包含匹配项。
-l--limit数字50页面大小。
--offset数字0跳过计数。
--sort-by字段Id descOData 排序表达式(例如MachineName asc )。

示例

# Attended sessions across the tenant, excluding Disconnected
uip or sessions attended list

# Only Busy sessions in a specific folder
uip or sessions attended list --folder-path "Shared" --state Busy

# Just machine names and states, script-friendly
uip or sessions attended list \
    --output-filter 'Data[].{m:MachineName, s:State}'
# Attended sessions across the tenant, excluding Disconnected
uip or sessions attended list

# Only Busy sessions in a specific folder
uip or sessions attended list --folder-path "Shared" --state Busy

# Just machine names and states, script-friendly
uip or sessions attended list \
    --output-filter 'Data[].{m:MachineName, s:State}'

数据形状(--输出 json)

{
  "Code": "SessionList",
  "Data": [
    {
      "Id": 501,
      "HostMachineName": "host-01",
      "MachineId": 101,
      "MachineName": "attended-01",
      "State": "Available",
      "Job": null,
      "ReportingTime": "2025-04-15T10:30:00Z",
      "Info": "",
      "IsUnresponsive": false,
      "LicenseErrorCode": "",
      "OrganizationUnitId": 42,
      "FolderName": "Shared",
      "RobotSessionType": "Attended",
      "Version": "23.10.0",
      "Source": "Studio",
      "DebugModeExpirationDate": "",
      "UpdateInfo": null,
      "InstallationId": "",
      "Platform": "Windows",
      "EndpointDetection": ""
    }
  ]
}
{
  "Code": "SessionList",
  "Data": [
    {
      "Id": 501,
      "HostMachineName": "host-01",
      "MachineId": 101,
      "MachineName": "attended-01",
      "State": "Available",
      "Job": null,
      "ReportingTime": "2025-04-15T10:30:00Z",
      "Info": "",
      "IsUnresponsive": false,
      "LicenseErrorCode": "",
      "OrganizationUnitId": 42,
      "FolderName": "Shared",
      "RobotSessionType": "Attended",
      "Version": "23.10.0",
      "Source": "Studio",
      "DebugModeExpirationDate": "",
      "UpdateInfo": null,
      "InstallationId": "",
      "Platform": "Windows",
      "EndpointDetection": ""
    }
  ]
}

uip or sessions machines list

按计算机密钥列出一台计算机的会话。计算机密钥是uip or machines list返回的 GUID。可以选择将作用域设置为文件夹。

参数

名称必填用途
<machine-key>计算机密钥 (GUID)。使用uip or machines list查找。

选项

默认描述
--folder-keyGUID文件夹范围内列表的文件夹键。
--folder-path路径文件夹范围列表的文件夹路径。
-l--limit数字50页面大小。
--offset数字0跳过计数。
--sort-by字段Id descOData 排序表达式。

示例

uip or sessions machines list a1b2c3d4-0000-0000-0000-000000000001
uip or sessions machines list a1b2c3d4-0000-0000-0000-000000000001 \
    --folder-path "Production"
uip or sessions machines list a1b2c3d4-0000-0000-0000-000000000001
uip or sessions machines list a1b2c3d4-0000-0000-0000-000000000001 \
    --folder-path "Production"

数据形状(--输出 json)

{
  "Code": "SessionGetMachine",
  "Data": [
    {
      "Id": 601,
      "ServiceUserName": "svc-runner",
      "HostMachineName": "prod-worker-01",
      "MachineId": 101,
      "MachineName": "prod-worker-01",
      "State": "Available",
      "Job": null,
      "ReportingTime": "2025-04-15T10:30:00Z",
      "Info": "",
      "IsUnresponsive": false,
      "LicenseErrorCode": "",
      "OrganizationUnitId": 42,
      "FolderName": "Shared",
      "RobotSessionType": "Unattended",
      "Version": "23.10.0",
      "Source": "",
      "DebugModeExpirationDate": "",
      "UpdateInfo": null,
      "InstallationId": "",
      "Platform": "Windows",
      "EndpointDetection": ""
    }
  ]
}
{
  "Code": "SessionGetMachine",
  "Data": [
    {
      "Id": 601,
      "ServiceUserName": "svc-runner",
      "HostMachineName": "prod-worker-01",
      "MachineId": 101,
      "MachineName": "prod-worker-01",
      "State": "Available",
      "Job": null,
      "ReportingTime": "2025-04-15T10:30:00Z",
      "Info": "",
      "IsUnresponsive": false,
      "LicenseErrorCode": "",
      "OrganizationUnitId": 42,
      "FolderName": "Shared",
      "RobotSessionType": "Unattended",
      "Version": "23.10.0",
      "Source": "",
      "DebugModeExpirationDate": "",
      "UpdateInfo": null,
      "InstallationId": "",
      "Platform": "Windows",
      "EndpointDetection": ""
    }
  ]
}

uip 或会话列表用户名

返回当前连接到 Orchestrator 的用户的用户名。对于快速回答“谁现在处于活动状态?”非常有用。

选项

默认描述
-l--limit数字50页面大小。
--offset数字0跳过计数。
--sort-by字段排序表达式(默认为空)。

示例

uip or sessions list-usernames
uip or sessions list-usernames --limit 200
uip or sessions list-usernames
uip or sessions list-usernames --limit 200

数据形状(--输出 json)

{
  "Code": "SessionListUsernames",
  "Data": ["admin@example.com", "ops@example.com"]
}
{
  "Code": "SessionListUsernames",
  "Data": ["admin@example.com", "ops@example.com"]
}

uip or sessions unattended list

列出 Unattended 会话运行时 — Unattended 计算机的插槽使用情况视图。如果不带文件夹标志,将返回租户中的会话。使用--folder-key--folder-path将返回限定在文件夹范围内的会话。

选项

默认描述
--folder-keyGUID文件夹范围内列表的文件夹键。
--folder-path路径文件夹路径(例如Shared )。
--runtime-type枚举按 runtime 类型筛选(例如, UnattendedAttendedHeadlessServerless )。
-l--limit数字50页面大小。
--offset数字0跳过计数。
--sort-by字段SessionId descOData 排序表达式。

示例

# All unattended runtimes in the tenant
uip or sessions unattended list

# Serverless-only in a specific folder
uip or sessions unattended list --folder-path "Shared" \
    --runtime-type Serverless
# All unattended runtimes in the tenant
uip or sessions unattended list

# Serverless-only in a specific folder
uip or sessions unattended list --folder-path "Shared" \
    --runtime-type Serverless

数据形状(--输出 json)

{
  "Code": "SessionListMachineSessions",
  "Data": [
    {
      "SessionId": 701,
      "MachineId": 101,
      "MachineKey": "a1b2c3d4-0000-0000-0000-000000000001",
      "MachineName": "prod-worker-01",
      "MaintenanceMode": "Default",
      "HostMachineName": "prod-worker-01",
      "RuntimeType": "Unattended",
      "MachineType": "Standard",
      "MachineScope": "Default",
      "Status": "Available",
      "IsUnresponsive": false,
      "Runtimes": 3,
      "UsedRuntimes": 1,
      "ServiceUserName": "svc-runner",
      "ReportingTime": "2025-04-15T10:30:00Z",
      "Version": "23.10.0",
      "DebugModeExpirationDate": "",
      "Platform": "Windows",
      "EndpointDetection": "",
      "TriggersCount": 0
    }
  ]
}
{
  "Code": "SessionListMachineSessions",
  "Data": [
    {
      "SessionId": 701,
      "MachineId": 101,
      "MachineKey": "a1b2c3d4-0000-0000-0000-000000000001",
      "MachineName": "prod-worker-01",
      "MaintenanceMode": "Default",
      "HostMachineName": "prod-worker-01",
      "RuntimeType": "Unattended",
      "MachineType": "Standard",
      "MachineScope": "Default",
      "Status": "Available",
      "IsUnresponsive": false,
      "Runtimes": 3,
      "UsedRuntimes": 1,
      "ServiceUserName": "svc-runner",
      "ReportingTime": "2025-04-15T10:30:00Z",
      "Version": "23.10.0",
      "DebugModeExpirationDate": "",
      "Platform": "Windows",
      "EndpointDetection": "",
      "TriggersCount": 0
    }
  ]
}

uip 或会话列表用户执行程序

列出分配给每个用户的自动化执行者。返回按用户名分组的机器人(执行程序)名称 — 对于发现哪些用户拥有哪些无人值守机器人非常有用。

选项

默认描述
-l--limit数字50页面大小。
--offset数字0跳过计数。
--sort-by字段排序表达式(默认为空)。

示例

uip or sessions list-user-executors
uip or sessions list-user-executors

数据形状(--输出 json)

{
  "Code": "SessionListUserExecutors",
  "Data": [
    { "UserName": "admin@example.com", "RobotNames": ["prod-worker-01", "prod-worker-02"] },
    { "UserName": "ops@example.com", "RobotNames": ["dev-serverless"] }
  ]
}
{
  "Code": "SessionListUserExecutors",
  "Data": [
    { "UserName": "admin@example.com", "RobotNames": ["prod-worker-01", "prod-worker-02"] },
    { "UserName": "ops@example.com", "RobotNames": ["dev-serverless"] }
  ]
}

uip 或会话切换调试模式

在计算机会话中切换调试模式。启用调试模式允许将 Studio 实例连接到正在运行的会话。使用sessions unattended listsessions machines list <machine-key>查找会话 ID。

参数

名称必填用途
<session-id>会话 ID(整数)。

选项

默认描述
--enabledtrue/false—(必填项)启用或禁用调试模式。
--minutes数字调试模式保持活动状态的持续时间(以分钟为单位)。

示例

# Enable debug mode for 60 minutes
uip or sessions toggle-debug-mode 701 --enabled true --minutes 60

# Disable debug mode
uip or sessions toggle-debug-mode 701 --enabled false
# Enable debug mode for 60 minutes
uip or sessions toggle-debug-mode 701 --enabled true --minutes 60

# Disable debug mode
uip or sessions toggle-debug-mode 701 --enabled false

数据形状(--输出 json)

{
  "Code": "SessionToggleDebugMode",
  "Data": {
    "SessionId": 701,
    "Enabled": true,
    "Status": "Debug mode updated successfully"
  }
}
{
  "Code": "SessionToggleDebugMode",
  "Data": {
    "SessionId": 701,
    "Enabled": true,
    "Status": "Debug mode updated successfully"
  }
}

uip 或会话删除-不活动

删除断开连接或无响应(非活动)的会话。提供一个或多个会话 ID 以定位特定会话,或省略所有 ID 以删除租户中每个不活动的会话。

参数

名称必填用途
[session-ids...]会话 ID(整数)。省略删除所有非活动会话的操作。

选项

默认描述

示例

# Delete specific inactive sessions
uip or sessions delete-inactive 701 702

# Delete every inactive session in the tenant
uip or sessions delete-inactive
# Delete specific inactive sessions
uip or sessions delete-inactive 701 702

# Delete every inactive session in the tenant
uip or sessions delete-inactive

数据形状(--输出 json)

使用显式 ID:

{
  "Code": "SessionDeleteInactive",
  "Data": {
    "SessionIds": [701, 702],
    "Count": 2,
    "Status": "Inactive sessions deleted successfully"
  }
}
{
  "Code": "SessionDeleteInactive",
  "Data": {
    "SessionIds": [701, 702],
    "Count": 2,
    "Status": "Inactive sessions deleted successfully"
  }
}

不带 ID:

{
  "Code": "SessionDeleteInactive",
  "Data": { "Status": "All inactive sessions deleted successfully" }
}
{
  "Code": "SessionDeleteInactive",
  "Data": { "Status": "All inactive sessions deleted successfully" }
}

uip 或会话设置-维护-模式

将计算机会话置于维护模式(或退出)。维护可防止将新作业分配给会话。启用维护时, --stop-jobs-strategy会控制是软停止还是强制终止正在运行的作业。

参数

名称必填用途
<session-id>会话 ID(整数)。

选项

默认描述
--maintenance-mode枚举—(必填项)DefaultEnabled
--stop-jobs-strategy枚举SoftStop (从容)或Kill (立即)。仅在启用维护时适用。

示例

# Enable maintenance, soft-stop running jobs
uip or sessions set-maintenance-mode 701 \
    --maintenance-mode Enabled --stop-jobs-strategy SoftStop

# Take the session back out of maintenance
uip or sessions set-maintenance-mode 701 --maintenance-mode Default
# Enable maintenance, soft-stop running jobs
uip or sessions set-maintenance-mode 701 \
    --maintenance-mode Enabled --stop-jobs-strategy SoftStop

# Take the session back out of maintenance
uip or sessions set-maintenance-mode 701 --maintenance-mode Default

数据形状(--输出 json)

{
  "Code": "SessionSetMaintenanceMode",
  "Data": {
    "SessionId": 701,
    "MaintenanceMode": "Enabled",
    "Status": "Maintenance mode updated successfully"
  }
}
{
  "Code": "SessionSetMaintenanceMode",
  "Data": {
    "SessionId": 701,
    "MaintenanceMode": "Enabled",
    "Status": "Maintenance mode updated successfully"
  }
}
  • uip or machines — 将计算机名称解析为sessions machines list键。
  • uip or users — 用户目录;会话用户名映射回此处的用户记录。
  • uip or jobs — 调查在会话中运行的作业。

另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新