【发布时间】:2021-01-25 19:03:08
【问题描述】:
我正在尝试编写一个 PowerShell 脚本来部署和 SSIS 项目。这是我的代码。
# Variables
$SSISNamespace = "Microsoft.SqlServer.Management.IntegrationServices"
$TargetServerName = "FBISQL003DV"
$TargetFolderName = "DEV"
$ProjectFilePath = "C:\Users\Brian.Ciampa\source\Workspaces\TFICM2\TFCIM\DEV\CIM\SSIS\BC_TEST\bin\Development\BC_TEST.ispac"
$ProjectName = "BC_TEST"
# Load the IntegrationServices assembly. This is located at C:\windows\assembly.
$loadStatus = [System.Reflection.Assembly]::Load("Microsoft.SQLServer.Management.IntegrationServices, "+
"Version=13.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)
Write-Host "Done."
但是,我不断收到此消息:
New-Object : Could not load file or assembly 'Microsoft.SqlServer.Dmf.Common, Version=13.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
At C:\Users\Brian.Ciampa\desktop\SSIS_Deploy.ps1:20 char:24
+ ... nServices = New-Object $SSISNamespace".IntegrationServices" $sqlConne ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.NewObjectCommand
Microsoft.SqlServer.Dmf.dll 和 Microsoft.SqlServer.Dmf.Common.dll 文件位于该文件夹中。我需要做什么?
谢谢! 布赖恩
【问题讨论】:
标签: powershell ssis