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