2016-04-26 96 views
0

当我从powershell执行psexec \\<remote-machine> -u <user> -i 2 cmd.exe /c D:\temp_copy\run1.bat时,它会执行。但是当我尝试从詹金斯执行相同的操作时,它会给出The term '.\psexec' is not recognized as the name of a cmdlet, function, script...。我也注入了环境变量,这些变量具有psexec的路径,但仍然失败。有人能指导我需要做什么吗?从jenkins中的powershell执行PsExec

+1

您可以尝试指定psexec的完整路径,或者在脚本中使用'(gci env:Path | select -ExpandProperty Value)-split';''转储* path *环境以确保路径在那里。 –

+0

它具有PSTools的路径,它包含psexec.exe – HunterrJ

+0

但是,当从詹金斯检查它不存在。 – HunterrJ

回答

0

想通了,我打开services.msc,右键点击Jenkins-> Properties-> Log On tab-> Local System Account。以前它是用我的用户名登录的,所以可能它没有访问权限。现在它工作正常。