For running our UI tests were using the task "Visual Studio test agent deployment", which has been deprecated now. So i have moved the tasks to use "Visual Studio Test" task.
This needs agents to be configured as interactive process rather than service. So i created a new build server with interactive process agent running with admin rights user.
For signing or code we are using signed certificates that gets installed on the build server. But for some reason this new build server seems to loose the certificate cred every single time the pipeline runs.
I have tried to to run a ps1 file to reinstall the cert with no success. Below id the code that i have for reinstalling the cert and i am using task "PowerShell on target machines" to run the script. The user running this script is admin on the box, is there a different way of getting the ps1 file to run as admin all the time?
Set-Location "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools"
Start-Process cmd.exe
Sleep 2
$WshShell = New-Object -ComObject WScript.Shell
Sleep 2
$WshShell.sendkeys(".\sn.exe -d $KeyContainer{Enter}");
Sleep 2
$WshShell.sendkeys(".\sn.exe -i $PfxCertificatePath $KeyContainer{Enter}");
Sleep 2;
$WshShell.sendkeys("$passWord{Enter}");
Sleep 2;
$WshShell.sendkeys("{Enter}");
Any help would be greatly appreciated.