Skip to content

Get-DbaDbTable ignores -SqlCredential parameter #10134

@3891sinneD

Description

@3891sinneD

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

When running a script as SYSTEM (through our deployment tool agent), Get-DbaDbTable ignores -SqlCredential parameter.
Microsoft.Data.SqlClient.SqlException: Login failed for user 'DOMAIN\COMPUTERACCOUNT$'.
Exception calling "ClearAndInitialize" with "2" argument(s): "Failed to connect to server ."
The script I use has more DbaTools commands, and all of them uses the same -SqlCredential parameter and they all work fine, except Get-DbaDbTable
I tried dbatools 2.5.5 and that version works fine, Get-DbaDbTable uses the -SqlCredential and it'll login as the account specified.

Steps to Reproduce

Get-DbaDbTable -SqlInstance <SQLSERVER> -SqlCredential <PSCREDENTIAL> -Database <DATABASE> -Table <TABLE> -EnableException

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

2.7.23

Other details or mentions

No response

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.20348.4294
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.4294
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) - 16.0.1000.6 (X64) Oct 8 2022 05:58:25 Copyright (C) 2022 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2022 Standard 10.0 (Build 20348: ) (Hypervisor)

.NET Framework Version

.NET Framework 4.8.9315.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions