You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for the code - even now, it still provides much value. And I think it's worth a PR.
I run Invoke-SqlCmd2 with a combination of ErrorAction SilentlyContinue and ErrorVariable; this gives me a way to parse errors and add value for my use case (I have a wrapper function that injects creds and default values). I do not want to emit the errors to the stream, as they include permission errors where I want my wrapper to retry with the next credential.
I have found that the script attempts to continue execution when continuing makes no sense.
if ($PSBoundParameters.Verbose) {Write-Verbose"SQL Error: $Err"} #Shiyang, add the verbose output of exception
- it should not be inspecting PSBoundParameters to determine whether or not to Write-Verbose; it should Write-Verbose and allow the engine to handle the stream. There is a naked Write-Verbose just above; L486 should also behave like that.
Hi,
First of all, thank you for the code - even now, it still provides much value. And I think it's worth a PR.
I run Invoke-SqlCmd2 with a combination of
ErrorAction SilentlyContinue
andErrorVariable
; this gives me a way to parse errors and add value for my use case (I have a wrapper function that injects creds and default values). I do not want to emit the errors to the stream, as they include permission errors where I want my wrapper to retry with the next credential.I have found that the script attempts to continue execution when continuing makes no sense.
I have a device where
PowerShell/Invoke-Sqlcmd2.ps1
Line 478 in 7d136b1
VIEW DATABASE STATE permission denied in database 'master'.
PowerShell/Invoke-Sqlcmd2.ps1
Line 486 in 7d136b1
PowerShell/Invoke-Sqlcmd2.ps1
Lines 488 to 494 in 7d136b1
PowerShell/Invoke-Sqlcmd2.ps1
Line 526 in 7d136b1
You cannot call a method on a null-valued expression.
Expected behaviour when run with -EA SilentlyContinue and -EV set:
VIEW DATABASE STATE permission denied in database 'master'.
finally
block atPowerShell/Invoke-Sqlcmd2.ps1
Lines 512 to 519 in 7d136b1
The text was updated successfully, but these errors were encountered: