I'm using the sqlpackage.exe tool to publish the dacpac (using poweshell).
How can I write the output from the below command to file:
$sqlpackage = Start-Process -FilePath sqlpackage.exe -ArgumentList '/Action:Publish','/SourceFile:"Database Services\bin\Release\Database Services.dacpac"',"/TargetServerName:${Env}","/TargetDatabaseName:${Target}",'/p:BlockOnPossibleDataLoss=True' -wait -PassThru -Credential $Cred
example for output:
Publishing to database 'test' on server 'TEST'.
Initializing deployment (Start)
Initializing deployment (Complete)
Analyzing deployment plan (Start)
Analyzing deployment plan (Complete)
Updating database (Start)
Update complete.
Updating database (Complete)
Successfully published database.
Time elapsed 0:03:18.51
I tried to use Tee-Object -File "sqlpackage.log" but the output looks like that:
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
0 0 0 155.75 3608