S
S
Smilley2021-07-13 17:11:16
PowerShell
Smilley, 2021-07-13 17:11:16

Why is Powershell script not working from another user in Jenkins?

Hello! There was a task to run the program on behalf of another user, but, unfortunately, I ran into a problem that the script does not work. No errors are output, just bare console output in Jenkins. Where can I see the log what's wrong?

Stage('Test SSO') {
  steps {
    powershell label: '', script: '''
      \$securePassword = ConvertTo-SecureString \'Password\' -AsPlainText -Force
      \$credential = New-Object System.Management.Automation.PSCredential .\\local_login , \$securePassword         
      Start-Process \'whoami.exe\' -Credential \$credential
    '''
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Smilleey, 2021-07-14
@Smilley

Powershell never won... they wrote a console utility that takes a login, a password from whom to run and a path to run as input. Next, it launches and normally prints the entire console output...

M
Morrowind, 2021-07-13
@hekkaaa

Hello.
Most likely your problem is related to the PS scripts execution policy .
PS has such a feature as running the script on other computers. You must first remove or select the optimal security policy on the executable machine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question