Skip to content

"unable to load DLL 'Microsoft.Data.SqlClient.SNI.dll'" errors with pwsh and credentials #28

@paschott

Description

@paschott

Verified issue does not already exist?

Yes

What error did you receive?

Started getting "unable to load DLL 'Microsoft.Data.SqlClient.SNI.dll' " errors w/ dbatools in pwsh when trying to run commands using credentials.

e.g., Get-DbaMaxMemory machinename -SqlCredential $cred throws that error.

I seem to get it whenever passing in a credential w/ a dbatools function, but that same credential works for a native command like "Enter-PSSession".

Steps to Reproduce

Get-DbaMaxMemory machinename -SqlCredential $cred

Get "unable to load DLL 'Microsoft.Data.SqlClient.SNI.dll' " error

Are you running the latest release?

Yes

Other details or mentions

This command worked within the last month or so as I use dbatools functions pretty regularly and have to pass in alternate credentials to connect to various machines. Here are the changes I can think of:
SSMS v18.11.1 upgrade
dbatools upgrade (to latest releases)
pwsh.exe upgrade to v7.2.2

These functions work on the same machine using Windows PowerShell v5.1

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

Name Value


PSVersion 7.2.2
PSEdition Core
GitCommitId 7.2.2
OS Microsoft Windows 10.0.19043
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

n/a

.NET Framework Version

.NET 6.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions