检查平台时 TeamCity 代理推送失败

TeamCity Agent Push Failure when Checking Platform

尝试使用代理推送功能安装代理时出现以下错误:

[12:05:15]: AgentPush v32407 - Install Agent on remote host
[12:05:15]: Looking for Target Host...
[12:05:15]: Validating TeamCity Server Root URL 'http://####' ...
[12:05:19]: Starting agent push to '###'(IP: ###) using preset 'Packer Baker' (Username 'administrator'. Target platform: 'Windows')
[12:05:19]: Checking Platform...
[12:05:24]: 'ssw0rd'' is not recognized as an internal or external command,
[12:05:24]: operable program or batch file.
[12:05:24]: Executing command: 'C:\Tomcat\temp\___1655843086080428423\cli-wrapper.exe D:\TMC-Data\system\pluginData\psexec\psexec.exe /accepteula \### -e -h -u administrator -p ********** cmd.exe /C ver'
[12:05:24]: Remote agent installation failed: Command 'C:\Tomcat\temp\___1655843086080428423\cli-wrapper.exe D:\TMC-Data\system\pluginData\psexec\psexec.exe /accepteula \### -e -h -u administrator -p ********** cmd.exe /C ver' was executed with error message(s): Execution error. Return code=1

知道是什么原因造成的吗?

这是由于没有转义 "Credentials to push agent" 密码中的 & 字符造成的。

在上面的例子中我使用了密码P&ssw0rd。当命令

C:\Tomcat\temp\___1655843086080428423\cli-wrapper.exe D:\TMC-Data\system\pluginData\psexec\psexec.exe /accepteula \### -e -h -u administrator -p ********** cmd.exe /C ver

执行&用于运行同一行多条命令,需要转义

使用 ^ 转义 & 并将密码更改为 P^&ssw0rd 后,代理推送 运行 成功。