If you want to pipe output from msbuild to a logging or processing cmdlet, you should not be starting it with Start-Process
, just execute it normally.
PS> msbuild.exe $flag1 $flag2 $thingToBuild | Write-Buildlog
You might need to also redirect stderr to capture more of the output. In that case you would need to add 2>&1
PS> msbuild.exe $flag1 $flag2 $thingToBuild 2>&1 | Write-Buildlog
Start-Process
will start your process outside of any powershell environment or hosting, so obtaining output and sending to cmdlets becomes much more difficult. If you want to process executable output in powershell, then it's best to simply stay within a powershell environment the whole time.