As part of our TFS build definitions we included a custom PowerShell as a last build step to identify the left over process from the build and kill them.
Inside the script we added below PowerShell command to list all the Dlls and the process associated with it. after that we loop through the output to get the process details and kill it.
$dllsByProc = Invoke-Expression -Command "E:\BuildSetup\SysinternalsSuite\Listdlls.exe -d E:\Dev\D\47\s"
Write-Host $dllsByProc
This all works fine when i run the script on a PowerShell window in admin mode but doesn't work when i add this script as a build step.
This confirms me that i need to run the ListDlls.exe gives the complete result only when run in admin mode.
My questions is how i can run a PowerShell command in admin mode from TFS build step
TIA
Thanks all for the response.
I can't say this as a solution but a workaround. One interesting thing i noticed is that when we execute a power shell script inline of a build step,then the script is getting executed as intended (i,e the script is getting executed as in admin mode.
So i condensed my script to fit in as inline script and obtained the desired result