VSTS Test Agent - IPC Port Access Denied

299 Views Asked by At

My test agent and controller are communicating well. But, when agent machine has restarted the agent is going to offline. And it is coming "online" only when I remotely login into the machine. To automate this, I tried PowerShell script. When I run my PS code on agent machine directly it is working fine and agent process is starting and it is communicating with the controller. When I try to run from other machine, it is able to start the process QTAgentProcessUI.exe. But failing to launch the agent UI. When I look in to the Event Viewer logs, it is showing

(QTDCAgent32.exe, PID 3780, Thread 1) DataCollectionAgentProcess: Failed to get agent process proxy: System.Runtime.Remoting.RemotingException: Failed to connect to an IPC Port: Access is denied.

How can we start agent process "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\QTAgentProcessUI.exe" on remote test agent machine with PowerShell by overcoming the access denied issues with port 6910?

In my investigation, I found that the Post 6910 is closed.

I am able to find out a work around. I created a VBS script and calling the PowerShell file in it. Then I created a scheduled task in Task Scheduler. When I trigger this schudled task from other machine, it is working like a charm. It is able to start the agent process.

The credentials which I am using below is an administrator on that machine.

$Username = 'xxxxxx'
$Password = 'xxxxx'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass

$s = New-PSSession -ComputerName "domain\machine1" -Credential $credentials

Invoke-Command -Session $s -Command {
    C:\Users\Administrator\Desktop\StartTestAgent.ps1
}
0

There are 0 best solutions below