Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,28 @@ function Invoke-SqlQueryDeployment

$additionalArguments = EscapeSpecialChars $additionalArguments

Write-Verbose "Invoke-SqlCmd arguments : $commandToLog $additionalArguments"
Invoke-Expression "Invoke-SqlCmd @spaltArguments $additionalArguments"
$commandToRun = $commandToLog + " " + $additionalArguments
Comment thread
v-abhishera marked this conversation as resolved.
Outdated
$command = "Invoke-SqlCmd @spaltArguments $additionalArguments"

Write-Host "##[command] $commandToRun"
Comment thread
v-abhishera marked this conversation as resolved.
Outdated

if ($additionalArguments.ToLower().Contains("-verbose")) {
Comment thread
v-abhishera marked this conversation as resolved.
Outdated
$errors = @()

$rawOutput = (Invoke-Expression $command -ErrorVariable errors 4>&1 | Out-String)
Comment thread
v-abhishera marked this conversation as resolved.
Outdated
$trimmedOutput = $rawOutput.TrimEnd()
$trimmedOutput -split "`r?`n" | Where-Object { $_.Trim() -ne "" } | ForEach-Object { Write-Output $_ }

if ($errors.Count -gt 0) {
throw
}
}
else {
Invoke-Expression $command
}
}
Catch {
Write-VstsSetResult -Result 'Failed' -Message "Error detected" -DoNotThrow
} # End of Try
Finally
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'TaskModuleSqlUtility.psm1'
ModuleVersion = '0.1.3'
ModuleVersion = '0.1.6'
Comment thread
starkmsu marked this conversation as resolved.
GUID = 'd997c6dd-33ad-481c-859b-01120229b91f'
Author = 'Microsoft'
CompanyName = 'Microsoft'
Expand Down
Loading