-
-
Notifications
You must be signed in to change notification settings - Fork 864
Connect-DbaInstance fails in PowerShell 7.5 with "untrusted domain" error while System.Data.SqlClient works #10265
Description
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
Error: Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication.
Steps to Reproduce
Failing dbatools test:
Connect-DbaInstance -SqlInstance "FQDN\Instance"
Error: Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication.
Please confirm that you are running the most recent version of dbatools
dbatools Version : 2.7.27
dbatools.library Version : 2025.12.28
Microsoft.Data.SqlClient Version : 6.0.0.0
Other details or mentions
Working connection test:
$conn = New-Object System.Data.SqlClient.SqlConnection("Server=FQDN\Instance;Integrated Security=true")
$conn.Open() # Works perfectly
$conn.Close()
Failing dbatools test:
Connect-DbaInstance -SqlInstance "FQDN\Instance"
Error: Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication.
This error happens when I try to connect to a server in another network segment but in the same AD. It fails when I run powershell 7.5 but works with powershell 5.1. Connecting directly with smo also works as well.
Some details about my environment.
Issue : Connect-DbaInstance fails with untrusted domain error in PS7
PowerShell Version : 7.5.4
PowerShell Edition : Core
OS : Microsoft Windows 10.0.20348
dbatools Version : 2.7.27
dbatools.library Version : 2025.12.28
Microsoft.Data.SqlClient Version : 6.0.0.0
System.Data.SqlClient Works : YES - Kerberos auth successful
Connect-DbaInstance Works PS5.1 : YES
Connect-DbaInstance Works PS7.5 : NO - untrusted domain error
Server Type : Named instance with FQDN
Auth Method : Windows Integrated (Kerberos)
Network : Cross-domain/forest scenario
What PowerShell host was used when producing this error
PowerShell Core (pwsh.exe), VS Code (terminal)
PowerShell Host Version
PowerShell Version : 7.5.4
PowerShell Edition : Core
OS : Microsoft Windows 10.0.20348
SQL Server Edition and Build number
Microsoft SQL Server 2019 (RTM-CU32-GDR) (KB5068404) - 15.0.4455.2 (X64) Oct 7 2025 21:10:15 Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)
.NET Framework Version
.NET 9.0.10