Backup database from default (unnamed) sql server instance with powershell.
- by sparks
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