Skip to content

The value's length for key 'Data Source' exceeds its limit of '128' for Invoke-DbaQuery and Get-DbaAvailabilityGroup #9634

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

Open
fgill-fortifieddata opened this issue Mar 26, 2025 · 4 comments
Labels
bugs life triage required New issue that has not been reviewed by maintainers

Comments

@fgill-fortifieddata
Copy link

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

WARNING: [12:12:56][Invoke-DbaQuery] Failure | The value's length for key 'Data Source' exceeds its limit of '128'.****

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference
Invoke-DbaQuery  -SqlInstance 'InstanceName' -Database master -Query 'SELECT @@VERSION'

and

Import-Module -Name DBATools

#Set-DbatoolsInsecureConnection -SessionOnly
 $sqlQuery = @"
SELECT DISTINCT --@@ServerName as Server_Name, 
	sjob.name AS Job_Name	
FROM msdb.dbo.sysjobs sjob
LEFT JOIN [msdb].[dbo].[sysjobsteps] AS [sJSTP]
	ON [sJSTP].[job_id] = [sJOB].[job_id]
WHERE [sJSTP].[subsystem] IN ('CmdExec', 'PowerShell', 'TSQL')
"@
$results = Invoke-Sqlcmd -Query $sqlQuery -ServerInstance 'InstanceName' -Database master 
Get-DbaAvailabilityGroup -SqlInstance 'InstanceName' -IsPrimary -verbos

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

2.1.30

Other details or mentions

We initially hit the error running Get-DbaAvailabilityGroup. While troubleshooting, I tried running Invoke-DbaQuery and received the same error. Uninstalling dbatools and installing version 1.1.145 allows the commands to run without error.

What PowerShell host was used when producing this error

Windows PowerShell ISE (powershell_ise.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.20348.2849
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2849
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2022 (RTM-CU18) (KB5050771) - 16.0.4185.3 (X64) Feb 28 2025 18:24:49 Copyright (C) 2022 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2022 Datacenter 10.0 (Build 20348: ) (Hypervisor)

.NET Framework Version

.NET Framework 4.8.4775.0

@fgill-fortifieddata fgill-fortifieddata added bugs life triage required New issue that has not been reviewed by maintainers labels Mar 26, 2025
@niphlod
Copy link
Contributor

niphlod commented Mar 26, 2025

smells like you have the sqlserver ps module loaded before dbatools

@fgill-fortifieddata
Copy link
Author

What is the recommended solution for this issue when running the latest version of dbatools? From what I am reading, I do not want to uninstall SQLPS, because SQL Agent uses it from PowerShell job steps. Is there a way to prevent it from loading before dbatools?

@niphlod
Copy link
Contributor

niphlod commented Mar 27, 2025

See what modules you have loaded via Get-Module . SQLPS must not be there when you load dbatools.
If you don't explicitely use any of the SQLPS cmdlets (e.g. invoke-sqlcmd) you shouldn't see "SQLPS" in the list.
If you see them, they're probably autoloaded at startup, probably via a profile.

@fgill-fortifieddata
Copy link
Author

fgill-fortifieddata commented Mar 28, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs life triage required New issue that has not been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants