0

I'm having a strange scenario where my command works on PowerShell manually but not when executed on Jenkins PowerShell plugin. I'm new to PowerShell and Jenkins and I'm thinking that there's a rule I'm missing. 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. It works as expected when executed on Powershell but in Jenkins, the build succeeds but it did not open the 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.

Here's what I tried:

  1. By default Jenkins uses 32-bit PowerShell, so I manually used the 64-bit but it didn't work.
  2. I made sure that Get-ExecutionPolicy is set to RemoteSigned on LocalMachine
  3. Run the script using Windows Batch Command
  4. I tried opening notepad but it does not work too.

Is this really the behavior of the PowerShell plugin? Is there any points that I'm missing? Kindly help me with this.

1 Answers1

0

To anyone might need this. I was able to execute the RDP via Jenkins PowerShell plugin.

What I did was to go Jenkins' Window Service > Log on tab > Select "This account" and enter your user account credentials.

I suspect this is a security issue. Jenkins by default is using the "SYSTEM" account which does not have enough privileges.