0

I have ReadyAPI on a physical machine and I have TFS running on a VM. I am trying to create a TFS build definition that runs a command line task to trigger the testrunner.bat with the correct arguements on the physical machine.

Now if I run the testrunner command line directly into the command prompt in the VM, it runs just as expected and generates a JUnit report in the physical machine.

However if I run this through the TFS UI, I get the following error:

The user name or password is incorrect.
Process completed with exit code 1.

TFS Command Line Task:

enter image description here

Ross
  • 2,463
  • 5
  • 35
  • 91

1 Answers1

1

Based on the error message, seems you are using the incorrect account to run the command.

In TFS the build agent service account will be used to run the testrunner.bat during the build process. So, you can try to set the account which works in VM as the build agent service account. Then try it again.

Besides, you can also try creating a PowerShell script to call the cmd.exe to run the command with another valid user account on target machine. Then add a PowerShell task in build definition to run the script. Reference this related thread : Write realtime powershell output during TFS release execution

e.g.:

Param(
  [string]$computerName = "VM-name",
)
$Username = "domain\username"
$Password = ConvertTo-SecureString "PasswordHere" -AsPlainText -Force

$cred = New-Object System.Management.Automation.PSCredential($Username,$password)

Invoke-Command -ComputerName $computerName  -Credential $cred -ErrorAction Stop -ScriptBlock {Invoke-Expression -Command:"cmd.exe /c 'C:\Test.bat arguments here'"}
Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • I believe both machines are running administrator and the TFS build service is running on administrator. Both the VM and PM are using Win Server 2012 r2 and WinRM does not seem to be supported on this version – Ross Jul 26 '18 at 07:31
  • @Ross I mean the agent service account which specified during [deploy an an agent](https://docs.microsoft.com/en-us/vsts/pipelines/agents/v1-windows?view=tfs-2015), you can set administrator account as the agent service account or add the agent service account to local administrator group, then try it again. WinRM is supported in Win Server 2012 R2, just following the steps mentioned in [WinRM configuration](https://docs.microsoft.com/en-us/vsts/pipelines/apps/cd/deploy-webdeploy-iis-winrm?view=vsts#winrm-configuration)(Step 4 -- ...for previous versions of Windows....) to configure WinRM. – Andy Li-MSFT Jul 26 '18 at 07:46