Closed AndyP2 closed 5 years ago
So sorry, this has a conflict and there was no follow up response to cookie's message. Please feel free to resync and resubmit.
That's not a problem, I have a version that works for my project anyway. The changes requested were much larger than the quick bug fix I submitted, so if anyone wants to add support for strict mode I'm happy for them to do it themselves.
I've had problems with verbosepreference values in modules in the past, and it would only solve one of the problems anyway.
Added guard clauses for $ApplicationName and $PSBoundParameters.Verbose, so missing values don't cause problems when running with Set-StrictMode -Version Latest.
Without them I get these error messages: The variable '$ApplicationName' cannot be retrieved because it has not been set. at Invoke-Sqlcmd2.ps1: line 386 The property 'Verbose' cannot be found on this object. Verify that the property exists. at Invoke-Sqlcmd2.ps1: line 467
To be honest my preference would be for $ApplicationName to be passed in as an optional parameter, but I don't know what the original Invoke-SqlCmd does here.