Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect-DbaInstance, honor -Database parameter #9585

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

niphlod
Copy link
Contributor

@niphlod niphlod commented Feb 10, 2025

Type of Change

Purpose

Honor -Database parameter in some cases (passed connstring, passed registeredinstance).

Approach

Connect-DbaInstance is quite a "hotpath" so I tried to make the edit just where needed, it shouldn't (finger crossed) break existing code, but we'll know from appveyor if so.

Commands to test

Before, this resulted in "master" being returned
Get-DbaRegServer -IncludeLocal | Connect-DbaInstance -Database msdb | % { $_.Query("select db_name()") }
now, it returns "msdb".

On my laptop (tm) it also returns "msdb" for
Get-DbaRegServer -IncludeLocal | Connect-DbaInstance -Database msdb | Invoke-DbaQuery -Query 'select db_name();' as reported in #9541 (thanks @mattcargile and @ReeceGoding , both the original report and the findings made me waste little time in finding the culprit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant