"Index was outside the bounds of the array" trying to return properties of SQL 2012 instance remotely using Powershell - by PegB

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 712011 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 12/6/2011 4:17:13 PM
Access Restriction Public


When I run the following statement from a SQL 2008 server against a SQL 2012 instance:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
$server = New-Object 'Microsoft.SqlServer.Management.SMO.Server' ("MySQLServer")

 I get the following error:
format-default : Index was outside the bounds of the array.
    + CategoryInfo          : NotSpecified: (:) [format-default], IndexOutOfRangeException
    + FullyQualifiedErrorId : System.IndexOutOfRangeException,Microsoft.PowerShell.Commands.FormatDefaultCommand

The same statement can successfully be run against a SQL 2008 R2 instance, again from a SQL 2008 server.  In all cases, the operating system is Windows 2008 R2 SP1.

I've seen there's another closed bug for a similar error trying to connect to 2012 using 2005/2008 SSMS (bug 666386) - is this the same issue?  
Sign in to post a comment.
Posted by Microsoft on 12/13/2011 at 4:41 AM
Connectivity from a lower version (SQL Server 2008) to a major higher version (SQL Server 2012) is not a supported scenario hence you are getting the error. You need to use SQL Server 2012 libraries to connect to SQL Server 2012. Yes, you are right, this issue is similar to bug #666386.

Keshav Ramarao
SQL Server Manegability