connecting to SQL server into DomainA from DomainB by using windows authentication with SMO object

Jul 20, 2010 at 1:06 PM
Hi, I am connecting to SQL server into DomainA from DomainB by using SMO object. I am using the following code: Dim conn As ServerConnection = New ServerConnection("DomainASERVER") conn.ConnectAsUser = True conn.ConnectAsUserName = "ayadav@DomainA.com" //"DomainA\ayadav" conn.ConnectAsUserPassword = "12345" conn.Connect() ' I am getting exception here Dim server As Server = New Server(conn) If (server.Databases IsNot Nothing) Then For Each dbs As Database In server.Databases Dim db As String = dbs.Name Next End If I am getting exception "There are currently no logon servers available to service the logon request." can anybody help me.........its vary urgent. Thanks in Advance Arun
Coordinator
Jul 20, 2010 at 5:59 PM
Edited Jul 20, 2010 at 8:06 PM
arunyadav_ece wrote:
Hi, I am connecting to SQL server into DomainA from DomainB by using SMO object. I am using the following code: Dim conn As ServerConnection = New ServerConnection("DomainASERVER") conn.ConnectAsUser = True conn.ConnectAsUserName = "ayadav@DomainA.com" //"DomainA\ayadav" conn.ConnectAsUserPassword = "12345" conn.Connect() ' I am getting exception here Dim server As Server = New Server(conn) If (server.Databases IsNot Nothing) Then For Each dbs As Database In server.Databases Dim db As String = dbs.Name Next End If I am getting exception "There are currently no logon servers available to service the logon request." can anybody help me.........its vary urgent. Thanks in Advance Arun

It appears your issue is in using SMO with VB.NET, this is a forum for discussions about the PowerShell-based CodePlex project SQL Server PowerShell Extensions. I would suggest posting your question on the SMO forum or StackOverflow

That said from a PowerShell V2 perspective I've tested the following code successfully. I don't have a multiple domains to test.

try {add-type -AssemblyName "Microsoft.SqlServer.ConnectionInfo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" -EA Stop}  catch {add-type -AssemblyName "Microsoft.SqlServer.ConnectionInfo"}
$con = new-object ("Microsoft.SqlServer.Management.Common.ServerConnection")
$con.ConnectAsUser = $true
$con.ConnectAsUserName = "ayadav@DomainA.com"
$con.ConnectAsUserPassword = "12345"
$con.Connect()
$con.ServerInstance = "Z002\sql2k8"
$con.Connect()
$con