Need to connect to remote server and execute ps1 script using jenkins

I created a Jenkins job that needs to connect to a remote machine and execute a ps1 script.

$pw = convertto-securestring -AsPlainText -Force -String "4444"
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "eeeee\eee",$pw
$sess = New-PSSession -ComputerName server1 -Credential $cred
Enter-PSSession $sess


Add the remote machine as a slave, then run your script from 'execute windows Batch command' or install Powershell plugin and 'Run powershell script'.


  1. Add windows slave:
  2. Powershell plugin:

Looks like you may be better served with Invoke-Command than Enter-PSSession.

Something along the lines of:

Invoke-Command -Credential $creds -ComputerName $server -FilePath $scriptname -ArgumentList $arg1, $arg2

Need Your Help

Scikit grid search for KNN regression ValueError: Array contains NaN or infinity

python numpy scikit-learn

I am trying to implement grid search for selecting best parameters for KNN regression using Scikit learn.

Order by clause in MySQL is not working inside a foreach loop

mysql sql-order-by

I'm trying to get the profiles names which are assigned to a specific subcategory