sql server - How do I resolve ambiguous type names in PowerShell? -
i trying instantiate microsoft.sqlserver.management.smo.server in powershell 2 , later. have sql server 2012 2014 installed. when call following ambiguous type name error.
[microsoft.sqlserver.management.smo.server]$srv = new-object "microsoft.sqlserver.management.smo.server" $serverinstance
the result error ambiguity in type name because 2 versions of smo installed:
new-object : type name 'microsoft.sqlserver.management.smo.server' ambiguous, 'microsoft.sqlserver.management.smo.server, microsoft.sqlserver.smo, version=12.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91' or 'microsoft.sqlserver.management.smo.server, microsoft.sqlserver.smo, version=11.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91'.
i have tried add-type , other methods load specific assembly, ambiguity remains.
a workaround might use get-item rather new-object, though have not tested script change.
how resolve ambiguous type names in powershell?
since petseral posts answers comments (i concede , remove if post answer):
new-object 'microsoft.sqlserver.management.smo.server, microsoft.sqlserver.smo, version=12.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91' $serverinstance
Comments
Post a Comment