1

我已经在另一个线程中提到了这个问题,但我认为错误的根源是另一个。现在我知道真正的错误,但无法解决,也不明白。

我想在 Azure 实例上安装 Visual Studio 测试控制器。我正在尝试通过启动任务来执行此操作,该任务运行一个批处理文件,该文件依次下载测试控制器安装文件并将其安装在实例上。

问题是:通过启动任务运行安装时不起作用。当我通过 RDP 登录机器并双击完全相同的批处理文件时,一切正常。

以下是一些附加信息:

这是我执行的批处理文件:

powershell $command = "set-executionpolicy Unrestricted"
powershell $command = ".\setupController.ps1" -NonInteractive >; out.txt
echo Setup TestController >> %~dp0out.txt
cd E:\approot
timeout /T 60
"E:\approot\testcontroller.exe" /full /q /Log %~dp0install.log
echo Setup has been executed! >> %~dp0out.txt
net user vstestagent MyPassword! /add
net localgroup Administrators vstestagent /add
REM Create a task that will run with full network privileges.
net start Schedule
schtasks /CREATE /TN "Configure Test Controller Service" /SC ONCE /SD 01/01/2020 /ST 00:00:00 /RL HIGHEST /RU vstestagent /RP MyPassword! /TR e:\approot\configcontroller.cmd /F
schtasks /RUN /TN "Configure Test Controller Service"

这是角色的启动任务:

<Task executionContext="elevated" taskType="background" commandLine="setupController.cmd"></Task>

批处理文件以及测试控制器的安装文件位于 E:\approot 文件夹中

testcontroller 的安装日志文件是这样说的:

0A88:0ABC][2013-04-12T10:36:04]: Creating a system restore point.    
[0A88:0ABC][2013-04-12T10:36:04]: System restore disabled, system    restore point not created. 
[0A88:0ABC][2013-04-12T10:36:04]: Caching    bundle from:    'C:\Resources\temp\48c0ec5daf5846cab7f53f6b5c80dc6f.TestController\RoleTemp\{44f19fb6-98e0-4462-886c-c5e56d82dfd3}\.be\vstf_testcontroller.exe'    to: 'D:\ProgramData\Package    Cache\{44f19fb6-98e0-4462-886c-c5e56d82dfd3}\vstf_testcontroller.exe'    
[0A88:0ABC][2013-04-12T10:36:04]: Registering bundle dependency    provider: {44f19fb6-98e0-4462-886c-c5e56d82dfd3}, version:
       11.0.51106.1 
[0A40:09EC][2013-04-12T10:36:04]: MUX:  Cache Begin 
[0A40:064C][2013-04-12T10:36:05]: Error 0x80070070: Failed to set end    of file. 
[0A40:064C][2013-04-12T10:36:05]: Error 0x80070070: Failed    to extract all files from container.    
[0A40:09EC][2013-04-12T10:36:05]: Error 0x80070070: Faild to begin    and wait for operation. 
[0A40:09EC][2013-04-12T10:36:05]: Error    0x80070070: Failed to extract payload: a25 from container:    WixAttachedContainer 
[0A40:09EC][2013-04-12T10:36:05]: Failed to    extract payloads from container: WixAttachedContainer to working    path: E:\approot\testcontroller.exe, error: 0x80070070.    
[0A40:0B98][2013-04-12T10:36:05]: Error 0x80070070: Failed while    caching, aborting execution. 
[0A88:0ABC][2013-04-12T10:36:05]:    Removed bundle dependency provider:    {44f19fb6-98e0-4462-886c-c5e56d82dfd3}
... Some Rollback and cleanup
[0A40:0B98][2013-04-12T10:36:06]: Variable: WixBundleTag = vstf_testcontroller,1031
[0A40:0B98][2013-04-12T10:36:06]: Variable: WixBundleVersion = 11.0.51106.1
[0A40:0B98][2013-04-12T10:36:06]: Exit code: 0x643, restarting: No

我真的不知道问题出在哪里 - 特别是因为当我通过 RDP 运行批处理文件时,一切正常。唯一的区别似乎是用户执行批处理:启动任务以管理权限运行,我认为我的 RDP 帐户是另一个帐户,但也具有管理权限....

最好的问候塞巴斯蒂安

4

1 回答 1

1

我仍然不知道为什么会这样,但是如果您通过计划任务进行安装,安装就可以了。

因为我认为唯一的区别可能是安装软件的帐户,所以我首先尝试通过 runas 命令安装测试控制器,但我无法将密码与命令一起传递。因此,我创建了一个用于安装测试控制器的计划任务,并且能够将用户凭据与命令一起传递。现在我的 setupController.cmd 看起来像这样:

powershell $command = "set-executionpolicy Unrestricted"
powershell $command = ".\setupController.ps1" -NonInteractive >; out.txt
echo Setup TestController >> %~dp0out.txt
cd E:\approot
echo Setup has been executed! >> %~dp0out.txt
net user vstestagent MyPassword! /add
net localgroup Administrators vstestagent /add
REM Create a task that will run with full network privileges.
net start Schedule
schtasks /CREATE /TN "Install Test Controller Service" /SC ONCE /SD 01/01/2020 /ST 00:00:00 /RL HIGHEST /RU vstestagent /RP MyPassword! /TR "E:\approot\testcontroller.exe /full /q /Log %~dp0install.log" /F
schtasks /RUN /TN "Install Test Controller Service"
timeout /T 120
schtasks /CREATE /TN "Configure Test Controller Service" /SC ONCE /SD 01/01/2020 /ST 00:00:00 /RL HIGHEST /RU vstestagent /RP MyPassword! /TR e:\approot\configcontroller.cmd /F
schtasks /RUN /TN "Configure Test Controller Service"

希望它也对其他人有所帮助。

于 2013-04-13T08:45:34.757 回答