使用PowerShell部署SSIS软件包

问题描述

我正在尝试通过PowerShell将.ispac文件部署到sql Server(2017)。到目前为止,我已经下载了sql Server PowerShell模块,当然还安装了SSIS(版本15.0.2000.93)。

我要运行的PowerShell脚本与文档中的脚本几乎相同:

# Variables
$SSISNamespace = "Microsoft.sqlServer.Management.IntegrationServices"
$TargetServerName = "name"
$TargetFolderName = "name"
$ProjectFilePath = "path"
$ProjectName = "name"

# Load the IntegrationServices assembly
$loadStatus = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.sqlServer.Management.IntegrationServices,"+
    "Version=14.0.0.0,Culture=neutral,PublicKeyToken=89845dcd8080cc91,processorArchitecture=MSIL")

# Create a connection to the server
$sqlConnectionString = `
    "Data Source=" + $TargetServerName + ";Initial Catalog=master;Integrated Security=sspI;"
$sqlConnection = New-Object System.Data.sqlClient.sqlConnection $sqlConnectionString

# Create the Integration Services object
$integrationServices = New-Object $SSISNamespace".IntegrationServices" $sqlConnection

# Get the Integration Services catalog
$catalog = $integrationServices.Catalogs["SSISDB"]

# Create the target folder
$folder = New-Object $SSISNamespace".CatalogFolder" ($catalog,$TargetFolderName,"Folder description")
$folder.Create()

Write-Host "deploying " $ProjectName " project ..."

# Read the project file and deploy it
[byte[]] $projectFile = [System.IO.File]::ReadAllBytes($ProjectFilePath)
$folder.DeployProject($ProjectName,$projectFile)

错误发生在第18行:

$integrationServices = New-Object $SSISNamespace".IntegrationServices" $sqlConnection

并说找不到该程序集或其依赖项(见下文):

“ Microsoft.sqlServer.Dmf.Common,版本= 13.0.0.0,区域性=中性, PublicKeyToken = 89845dcd8080cc91“

此外,当我通过右键单击SSMS(18.5)中的Integration Services目录尝试“启动PowerShell”时,出现错误

值不能为null。参数名称:value(mscorlib)

我不知道是否以某种方式连接了错误,但我希望它有助于发现问题。 我以管理员身份运行PowerShell,对读取或执行DLL没有任何限制。

非常感谢,您可以给我任何提示,我感到满意!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)