Skip to content

Getting warning using Connection object from Connect-DbaInstance with Invoke-DbaQuery #9665

Closed
@garyhampson

Description

@garyhampson

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

When I use the connection object created by Connect-DbaInstance in my call to Invoke-DbaQuery, I get the following message:

WARNING: [15:46:13][Connect-DbaInstance] Additional parameters are passed in, but they will be ignored

I have confirmed that it is actually the call to Invoke-DbaQuery that is raising this warning, not the call that creates the Connection object itself. I know that I can use the -WarningAction SilentlyContinue, but that seems like a kludge. Any suggestions? Examples 8 and onwards from the Connect-DbaInstance documentation will exhibit this behavior.

Steps to Reproduce

PS D:\Code\dbatoolkit> $Conn = Connect-DbaInstance -SqlInstance SQLServerAG01.domain.local -MultiSubnetFailover -TrustServerCertificate
PS D:\Code\dbatoolkit> Invoke-DbaQuery -SqlInstance $Conn -Database master -Query "SELECT DB_NAME()"
WARNING: [15:46:13][Connect-DbaInstance] Additional parameters are passed in, but they will be ignored

Column1
-------
master


### Please confirm that you are running the most recent version of dbatools

```powershell
PS D:\Code\dbatoolkit> Get-Module dbatools

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.1.30                dbatools                            {Select-DbaObject, Set-DbatoolsConfig, Add-DbaAgDatabase, Add

### Other details or mentions




### What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

### PowerShell Host Version

```powershell
PS D:\Code\dbatoolkit> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.1
PSEdition                      Core
GitCommitId                    7.5.1
OS                             Microsoft Windows 10.0.14393
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

### SQL Server Edition and Build number

Microsoft SQL Server 2019 (RTM-CU32) (KB5054833) - 15.0.4430.1 (X64)   Feb 21 2025 17:28:26   Copyright (C) 2019 Microsoft Corporation  Standard Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor) 

### .NET Framework Version

.NET 9.0.4

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions