The flags you want to msbuild are:
/target:publish
and:
/p:PublishDir=C:\Foo\
Notice that you must have a trailing \ on the publish dir or it simple perform the the dependent steps on publish (ie. build) and never actually generate an installer.
You may be interested in the msbuild npm package:
var msbuild = require('msbuild');
var path = require('path');
// Config
var source = 'source/Bar/Bar.App/Bar.App.csproj';
var deploy = path.join(__dirname, 'deploy');
// Build the project
var builder = new msbuild();
builder.sourcePath = source;
builder.overrideParams.push('/p:PublishDir=' + deploy + "\\"); // <-- Installer
builder.overrideParams.push('/Target:rebuild;publish');
builder.overrideParams.push('/P:Configuration=Release');
builder.overrideParams.push('/P:verbosity=diag');
builder.overrideParams.push('/P:Platform=x86');
builder.overrideParams.push('/fl');
builder.overrideParams.push('/flp:logfile=build.log;verbosity=diagnostic');
builder.publish();
...which you would run something like:
npm install msbuild
node builder.js
No powershell required.