Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Trying to connect to an instance of SQL Server 2008 on a server we'll call Sputnik. There are no firewalls in between the two devices.

Right now I'm just trying to list databases

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum") | Out-Null
$servername = "Sputnik"
$remoteServer = New-Object("Microsoft.SqlServer.Management.Smo.Server") $servername
$remoteServer.databases

The following error message occurs:

 The following exception was thrown when trying to enumerate the collection: 
 "Failed to connect to server Sputnik.".
 At line:1 char:15 + $remoteServer. <<<< databases 
 + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
 + FullyQualifiedErrorId : ExceptionInGetEnumerator
share|improve this question
add comment

1 Answer

A couple of suggestions: Since you're using Windows authentication does your Windows login have access to the remote server and are both machines on the same domain? Are you able to connect using other tools? One quick way to do so is to setup and ODBC connection: ODBC Data Source >> Add SQL Server >> Test Connection

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.