- 入门指南
- 了解 UiPath Robot
- 安装要求
- 为 Unattended 自动化任务安装机器人
- 为 Unattended 自动化配置机器人
- 为 Attended 自动化安装机器人
- 为 Attended 自动化配置机器人
- 集成
- 监管
- 故障排除
通过代理服务器重定向机器人
配置 UiPath 机器人,以在 Attended(用户模式)和 Unattended(服务模式)安装中使用代理服务器,包括proxy.json 设置。
每当您的基础架构使用代理将计算机/用户连接到互联网时,您还需要配置 Robot 才能使用此功能。
根据 Robot 安装模式的不同,提供两种可能的配置:
- Attended Robot - 用户模式安装
- Unattended Robot - 服务模式安装
为 Attended Robot(用户模式)配置代理
Attended Robot 会继承为您的网页浏览器配置的代理设置。
如果您的代理需要基本身份验证,Assistant 会在您首次尝试将 Robot 连接到 Orchestrator 时,提示您输入凭据。
您可以使用“使用网页浏览器进行配置”中所述的旧方法或使用 Windows 代理设置进行代理设置。
为 Unattended Robot(服务模式)配置代理
要正确配置服务模式机器人以使用代理,您需要修改 proxy.json 文件以及将运行自动化的用户帐户的相应 Windows 设置。
要在proxy.json中配置代理,请按照配置代理设置进行操作。
要为将运行自动化的用户帐户配置代理,请按照为有人值守的机器人配置代理的操作。
如要仅配置一次代理,请在proxy.json中参阅“为所有机器人流程使用计算机级别代理” 。
使用网页浏览器配置代理
-
打开“互联网属性”窗口。
-
在“连接”选项卡上,选择 LAN 设置。 系统将打开“局域网 (LAN) 设置”窗口。 根据您的设置,您可以设置代理配置脚本或代理服务器。
- 要使用代理脚本,请选择“使用自动配置脚本”,然后提供脚本的地址。
- 要手动设置代理服务器,请选择『为您的 LAN 使用代理服务器』,然后提供代理服务器的地址和端口。
-
要保存设置,请选择“确定”。
-
在网页浏览器中,通过访问 Orchestrator URL 来测试连接。
使用 Windows 设置配置代理
- 打开『代理设置』窗口。
- 要使用代理脚本,请在“自动代理设置”下开启“使用设置脚本”。 提供脚本的地址。
- 要手动设置代理服务器,请在“手动代理设置”下,开启“使用代理服务器”。 提供代理服务器的地址和端口。
重要提示:
将
http://前缀添加到代理服务器地址可防止机器人发出 HTTPS 调用。为确保代理按预期工作,请完全删除http://前缀,或添加同时带有http://和https://前缀的代理地址。 例如:- 不正确 -
http://proxyaddress, - 更正 -
https://proxyaddress,http://proxyaddress; https://proxyaddress
- 不正确 -
- 要保存设置,请选择“保存”。
使用 proxy.json文件配置代理
从 2025.10 开始,要为 Unattended Robot(服务模式)配置代理,您需要修改 proxy.json 文件。如果您从旧版本更新,且已设置代理,则会自动迁移到新文件。
-
导航到:
%ProgramData%\UiPath\Shared。 -
搜索
proxy.json文件,然后使用拥有管理员权限的文本编辑器(例如 Notepad++)将其打开。proxy.json文件支持多种配置,但无法同时支持所有配置。如果ScriptAddress和ProxyAddress同时存在,则优先支持ScriptAddress。{ "ScriptAddress": "http://localhost/proxy.pac", "ProxyAddress": "http://1.1.1.1:1234/", "BypassLocalAddresses": true, "BypassList": "server\\.domain\\.local$;www.google.com;192\\.168\\.\\d{1,3}\\.\\d{1,3}", "UserName": "myUser", "Password": "myPassword", "Domain": "myDomain" }{ "ScriptAddress": "http://localhost/proxy.pac", "ProxyAddress": "http://1.1.1.1:1234/", "BypassLocalAddresses": true, "BypassList": "server\\.domain\\.local$;www.google.com;192\\.168\\.\\d{1,3}\\.\\d{1,3}", "UserName": "myUser", "Password": "myPassword", "Domain": "myDomain" }备注:绕过列表应包含一个正则表达式字符串数组,这些字符串包含要绕过的服务器的 URI。 当您想转义正则表达式中的字符时,您需要使用
\\(例如:.被转义为\\.)。- 要使用代理脚本,请提供以下 json:
{ "ScriptAddress" : "http://proxy.address/proxy.pac" }{ "ScriptAddress" : "http://proxy.address/proxy.pac" } - 要提供代理地址,请提供以下 json:
{ "ProxyAddress": "http://proxy.address:1234/", "BypassLocalAddresses": true, "BypassList": "server\.domain\.local$;www.google.com;192\.168\.\d{1,3}\.\d{1,3}", "UserName": "myUser", #used for basic auth "Password": "myPassword", #used for basic auth "Domain": "myDomain" }{ "ProxyAddress": "http://proxy.address:1234/", "BypassLocalAddresses": true, "BypassList": "server\.domain\.local$;www.google.com;192\.168\.\d{1,3}\.\d{1,3}", "UserName": "myUser", #used for basic auth "Password": "myPassword", #used for basic auth "Domain": "myDomain" }
- 要使用代理脚本,请提供以下 json:
-
保存
proxy.json文件。 -
重新启动 UiPath 机器人服务或设备。
使用加密密码配置代理
如果您的安全策略不允许以明文形式存储代理密码,您可以填充 EncryptedPassword 字段,而非 Password。Robot 会在对代理进行身份验证时对其进行解密。
该字段具有以下语义:
- 明文优先。如果
Password和EncryptedPassword同时存在,则Password优先。若要依赖加密值,请将Password留空或完全移除。 - Windows 数据保护 API (DPAPI) 绑定到此计算机。密文通过 DPAPI(
LocalMachine作用域)生成,仅在生成密文的计算机上有效。
生成加密值
在机器人计算机上将以下脚本保存为 Encrypt-ProxyPassword.ps1,然后在普通 PowerShell 中运行,无需进行提升。
.\Encrypt-ProxyPassword.ps1 -Password 'myPassword'
.\Encrypt-ProxyPassword.ps1 -Password 'myPassword'
脚本将 Base64 编码密文打印到标准输出。
param(
[Parameter(Mandatory = $true)]
[string] $Password
)
Add-Type -AssemblyName System.Security
[Convert]::ToBase64String(
[Security.Cryptography.ProtectedData]::Protect(
[Text.Encoding]::UTF8.GetBytes($Password),
$null,
[Security.Cryptography.DataProtectionScope]::LocalMachine))
param(
[Parameter(Mandatory = $true)]
[string] $Password
)
Add-Type -AssemblyName System.Security
[Convert]::ToBase64String(
[Security.Cryptography.ProtectedData]::Protect(
[Text.Encoding]::UTF8.GetBytes($Password),
$null,
[Security.Cryptography.DataProtectionScope]::LocalMachine))
应用加密值
- 以 Administrator 权限打开
%ProgramData%\UiPath\Shared\proxy.json。 - 如果存在,请移除
Password字段。 - 使用脚本生成的值添加
EncryptedPassword:{ "ProxyAddress": "http://proxy.address:1234/", "BypassLocalAddresses": true, "UserName": "myUser", "EncryptedPassword": "AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA...", "Domain": "myDomain" }{ "ProxyAddress": "http://proxy.address:1234/", "BypassLocalAddresses": true, "UserName": "myUser", "EncryptedPassword": "AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA...", "Domain": "myDomain" } - 保存文件。
- 重新启动机器人服务。
为所有机器人流程使用计算机级代理
默认情况下,proxy.json 对于作为 Windows 服务运行的流程(即 UiPath 机器人服务和更新工作器)为只读状态。其他机器人进程(例如作业执行程序和 UiRobot.exe)从运行它们的帐户的 Windows 代理设置中获取其代理。要使这些流程读取 proxy.json,请执行以下操作:
- 按照使用
proxy.json文件配置代理中的说明配置proxy.json,如果您的代理需要基本身份验证,则包括代理凭据。 - 创建计算机范围内的环境变量
UIPATH_APPLY_SERVICE_PROXY,并将值设为True。 - 重新启动 UiPath 机器人服务或设备。
如果您的代理需要基本身份验证,请在 UserName 和 Password 中添加 EncryptedPassword,或在 proxy.json 中添加 — 设置此变量时,不会读取基于用户的代理凭据。使用集成的 Windows 身份验证,不需要凭据,因为流程将以其运行下的帐户进行身份验证。如果 proxy.json 既未声明 ProxyAddress 也未声明 ScriptAddress,则该流程将保留运行它的帐户的 Windows 代理设置(无需每用户凭据),并且机器人会记录警告。
在机器人安装期间配置代理设置
要在安装 Unattended Robot(服务模式)时添加代理设置,请使用安装命令中的专用命令行参数。
例如,以下命令将在服务模式下安装机器人,并使用脚本配置代理:
UiPathStudio.msi ADDLOCAL=Robot,RegisterService PROXY_SCRIPT_ADDRESS=http://localhost/proxy.pac
UiPathStudio.msi ADDLOCAL=Robot,RegisterService PROXY_SCRIPT_ADDRESS=http://localhost/proxy.pac
以下命令将在服务模式下安装机器人,并设置代理设置的基本身份验证:
UiPathStudio.msi ADDLOCAL=Robot,RegisterService PROXY_ADDRESS=http://my.proxy.net:8008 PROXY_USERNAME="myUser" PROXY_PASSWORD="myUser" PROXY_DOMAIN="myUser"
UiPathStudio.msi ADDLOCAL=Robot,RegisterService PROXY_ADDRESS=http://my.proxy.net:8008 PROXY_USERNAME="myUser" PROXY_PASSWORD="myUser" PROXY_DOMAIN="myUser"
检查代理服务器连接
- 将机器人连接到 Orchestrator
- 将一些包部署到包含先前所配置机器人的环境中。
- 导航至
%userprofile%\.nuget\文件夹,查看是否已下载相应的流程和活动包。 - 运行相应作业,检查是否能成功运行。