I have the below PowerShell
script which runs form Jenkins
on node of windows server 2019
(it suppose to run deploy
on sql server
):
$Username = $args[0]
$Password = $args[1]
$Env= $args[2]
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass
echo "******** Start SQL Deploy ********"
echo "----- B4 Start-Process Powershell.exe -----"
Start-Process -FilePath "msbuild" -ArgumentList '"Database Services\Database Services.sqlproj"','/t:deploy','/p:Configuration=Release','/p:TargetConnectionString=$Env','/p:BlockOnPossibleDataLoss=True','/p:TargetDatabase="test"','-fl','-flp:logfile=msbuild.log' -wait -LoadUserProfile -credential $cred
echo "----- After Start-Process Powershell.exe -----"
and my output is:
******** Start SQL Deploy ********
----- B4 Start-Process Powershell.exe -----
----- After Start-Process Powershell.exe -----
We can clearly see Start-Process
was not executed.
It's important to say it works locally for me, and only when I move to work with node
, it started to happens.
I saw similar issue was raised in jenkins forum, but no one commented on that: JENKINS-63978
I got the answer here (also was taken from some SO thread):