fix for $PSBoundParameters doesn't contain 'Verbose' and #24
Open
AndyP2 wants to merge 1 commit intoRamblingCookieMonster:masterfrom
Open
fix for $PSBoundParameters doesn't contain 'Verbose' and #24AndyP2 wants to merge 1 commit intoRamblingCookieMonster:masterfrom
AndyP2 wants to merge 1 commit intoRamblingCookieMonster:masterfrom
Conversation
…tput selected and query returns no results
Owner
|
Hiyo! Would you mind opening a pull request at the new home for Invoke-SqlCmd2? I keep the old file here for posterity, but it's now located here Also, can you post the error you get the the verbose spot? That might even be worth changing to look at Cheers! |
Author
|
???The verbose issue was giving me this:
System.Management.Automation.PropertyNotFoundException: The property 'Verbose' cannot be found on this object. Verify that the property exists.
? at Invoke-Sqlcmd<Process>, [...]\Invoke-SqlCmd2.ps1: line 434
It appears to be StrictMode related, as without Set-StrictMode -Version 3 it didn't complain. Unfortunately the scripts I am running set that.
I also get this, which is new in this version:
System.Management.Automation.RuntimeException: The variable '$ApplicationName' cannot be retrieved because it has not been set.
at Invoke-Sqlcmd<Process>, [...]\Invoke-SqlCmd2.ps1: line 408
The fix would again seem to be checking ApplicationName before accessing it, if you have to use global variables instead of parameters:
if ((Test-Path variable:ApplicationName) -and $ApplicationName) {
$CSBuilder["Application Name"] = $ApplicationName
}
I usually use $VerbosePreference for querying the verbose flag, but always seem to have to propagate it down the call chain manually with a function like this: https://gallery.technet.microsoft.com/scriptcenter/Inherit-Preference-82343b9d
I'll submit a pull request for the Tables[0] stuff at the end (which actually appears in multiple code paths, not just the one I was using), and await your opinion on the strict mode problems.
Cheers
?
Andy Pearmund.
…________________________________
From: Warren Frame <notifications@github.com>
Sent: 18 October 2017 01:47
To: RamblingCookieMonster/PowerShell
Cc: AndyP2; Author
Subject: Re: [RamblingCookieMonster/PowerShell] fix for $PSBoundParameters doesn't contain 'Verbose' and (#24)
Hiyo!
Would you mind opening a pull request at the new home for Invoke-SqlCmd2? I keep the old file here for posterity, but it's now located here<https://github.com/sqlcollaborative/Invoke-SqlCmd2/blob/master/Invoke-SqlCmd2/Public/Invoke-SqlCmd2.ps1>
Also, can you post the error you get the the verbose spot? That might even be worth changing to look at $VerbosePreference?
Cheers!
-
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#24 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AHmvrfXPfmOYIuK-pIlaTPbd49U_suC_ks5stUq3gaJpZM4P6xhL>.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/RamblingCookieMonster/PowerShell","title":"RamblingCookieMonster/PowerShell","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/RamblingCookieMonster/PowerShell"}},"updates":{"snippets":[{"icon":"PERSON","message":"@RamblingCookieMonster in #24: Hiyo!\r\n\r\nWould you mind opening a pull request at the new home for Invoke-SqlCmd2? I keep the old file here for posterity, but it's now located [here](https://github.com/sqlcollaborative/Invoke-SqlCmd2/blob/master/Invoke-SqlCmd2/Public/Invoke-SqlCmd2.ps1)\r\n\r\nAlso, can you post the error you get the the verbose spot? That might even be worth changing to look at `$VerbosePreference`?\r\n\r\nCheers!"}],"action":{"name":"View Pull Request","url":"#24 (comment)"}}}
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
'DataRow' output selected and query returns no results
It threw exceptions in these 2 places when trying to run an existing script that worked with Invoke-Sqlcmd.