[英]Powershell command works manually, but does not work when executed in Jenkins
I'm having a strange scenario where my command works on PowerShell manually but not when executed on Jenkins PowerShell plugin.我有一个奇怪的场景,我的命令手动在 PowerShell 上运行,但在 Jenkins PowerShell 插件上执行时却不行。 I'm new to PowerShell and Jenkins and I'm thinking that there's a rule I'm missing.
我是 PowerShell 和 Jenkins 的新手,我想我缺少一条规则。 I looked all over the here and net but I failed to find the solution.
我在这里和网上到处找,但我没有找到解决方案。
I created a job that executes a PowerShell script that opens an RDP file on my desktop using a freestyle project.我创建了一个执行 PowerShell 脚本的作业,该脚本使用自由式项目在我的桌面上打开一个 RDP 文件。 It works as expected when executed on Powershell but in Jenkins, the build succeeds but it did not open the RDP.
在 Powershell 上执行时,它按预期工作,但在 Jenkins 中,构建成功,但没有打开 RDP。
Here's the script:这是脚本:
Start-Process "$env:windir\system32\mstsc.exe" -ArgumentList "RDP File /h:900 /w:1600" -WindowStyle Minimized
I'm using Windows Server 2016.我正在使用 Windows 服务器 2016。
Here's what I tried:这是我尝试过的:
Is this really the behavior of the PowerShell plugin?这真的是 PowerShell 插件的行为吗? Is there any points that I'm missing?
有什么我遗漏的地方吗? Kindly help me with this.
请帮我解决这个问题。
To anyone might need this.任何人都可能需要这个。 I was able to execute the RDP via Jenkins PowerShell plugin.
我能够通过 Jenkins PowerShell 插件执行 RDP。
What I did was to go Jenkins' Window Service > Log on tab > Select "This account" and enter your user account credentials.我所做的是 go Jenkins 的 Window 服务 > 登录选项卡 > Select “此帐户”并输入您的用户帐户凭据。
I suspect this is a security issue.我怀疑这是一个安全问题。 Jenkins by default is using the "SYSTEM" account which does not have enough privileges.
Jenkins 默认使用没有足够权限的“SYSTEM”帐户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.