DbaTools错误。运行Export-DbaInstance

时间:2019-04-10 20:42:03

标签: powershell-v4.0 windows-server-2012-r2 dbatools

我正在跑步

Export-DbaInstance -SqlInstance $sourceServerName -Path $absPathToBackupScriptDir

并显示错误“无法加载文件或程序集“ Microsoft.SqlServer.ConnectionInfo”

我尝试安装适用于Visual Studio 2013和2017的Microsoft Visual C ++ Redistributable

我尝试使用下面的CMD将有问题的DLL(DbaTools模块中包含的DLL)添加到GAC中

gacutil.exe /i "C:\Program Files\WindowsPowerShell\Modules\dbatools\bin\smo\Microsoft.SqlServer.ConnectionInfo.dll" 

我尝试使用下面的Powershell安装DbaTools的最新版本(在撰写本文时,版本为〜0.9.x)

Invoke-Expression (Invoke-WebRequest -UseBasicParsing https://dbatools.io/in) 

输入的命令和完整的输出错误消息都在下面

Export-DbaInstance -SqlInstance $sourceServerName -Path $absPathToBackupScriptDir

'Could not load file or assembly 'Microsoft.SqlServer.ConnectionInfo' Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 or one of its dependencies. The system cannot find the file specified.'

1 个答案:

答案 0 :(得分:0)

如果我选择不导出复制设置,则不会尝试加载有问题的程序集,并且cmdlet将按预期运行。

class myList(list):
    def __init__(self, it=()):
        super().__init__(it)  # Perform list initialization with original values
        # Cycle through values and double each one
        for i, x in enumerate(self):
            self[i] = x * 2