Error : Cannot find type [Microsoft.SqlServer.Management.Smo.RelocateFile]:
I have multiple version of Microsoft.SqlServer.Management.So installed, from version 10.0, 11.0, 12.0 and 13.0.
Tried adding the following text on top of my script
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91") | Out-Null
And same error. Wow!
Until i bump into this site and made the following change.
Powershell runs as expected. Sweet!
If your path points to version 12, please change it and points to version 13 as shown above.
Comments