Skip to content

Commit 7b2a0ca

Browse files
author
Nitin Gurram
committed
Fixed issue when Test Agent is running as Process, it may not acquire the PAT Token from DTA Service
1 parent 1d3e000 commit 7b2a0ca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Tasks/DeployVisualStudioTestAgent/TestAgentConfiguration.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,11 @@ function InvokeDTAExecHostExe([string] $Version, [System.Management.Automation.P
772772
Try
773773
{
774774
$session = CreateNewSession -MachineCredential $MachineCredential
775+
# Make sure DTA Agent Execution Service starts first before invoking DTA Execution Host
776+
Invoke-Command -Session $session -ErrorAction SilentlyContinue -ErrorVariable err -OutVariable out { Start-Service -Name "DTAAgentExecutionService" }
777+
Write-Verbose -Message ("Error : {0} " -f ($err | out-string)) -Verbose
778+
Write-Verbose -Message ("Output : {0} " -f ($out | out-string)) -Verbose
779+
775780
Invoke-Command -Session $session -ErrorAction SilentlyContinue -ErrorVariable err -OutVariable out -scriptBlock { schtasks.exe /create /TN:DTAConfig /TR:$args /F /RL:HIGHEST /SC:MONTHLY ; schtasks.exe /run /TN:DTAConfig ; Sleep 10 ; schtasks.exe /change /disable /TN:DTAConfig } -ArgumentList $exePath
776781
Write-Verbose -Message ("Error : {0} " -f ($err | out-string)) -Verbose
777782
Write-Verbose -Message ("Output : {0} " -f ($out | out-string)) -Verbose

0 commit comments

Comments
 (0)