TeamCity 6.5 Powershell Runner Issue?


I am trying to run the following powershell script

Write-Host "build start"

try {

$orphanProcs = Get-Process | where-object {$_.ProcessName.Contains("PostSharp.User")}

    If ($orphanProcs) {
        Write-Host "Killing Orphans"
          $orphanProcs | foreach { Write-Host $_.ProcessName $_.Id }
        $orphanProcs | foreach { Kill $_.Id : Write-Host $? }
    } Else {
        Write-Host "no processes found"
catch {
    Write-Host "Problem with running the script"
Write-Host "Finished"

This gives the following output from TeamCity BuildLog

[12:04:41]: Starting: C:\Windows\system32\cmd.exe /c C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command - <F:\Utilities\cleanup-postsharp.ps1 && exit /b %ERRORLEVEL%
[12:04:41]: in directory: F:\Utilities
[12:04:42]: build start
[12:04:42]: Process exited with code 0

Is there an issue with the TeamCity Powershell runner? It doesn't get past line 1 for some reason

1 comment
Comment actions Permalink

I found out that in the build config settings I was running the powershell script as :

when i should have been running as :



Please sign in to leave a comment.