Home Dashboard Directory Help
Search

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


Status: 

Closed
 as By Design Help for as By Design


1
0
Sign in
to vote
Type: Bug
ID: 712011
Opened: 12/6/2011 4:17:13 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

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")
$server

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?
Details
Sign in to post a comment.
Posted by Microsoft on 12/13/2011 at 4:41 AM
Hello,
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.

Thanks,
Keshav Ramarao
SQL Server Manegability
Sign in to post a workaround.