2013-04-04 59 views
2

我想用PowerShell以編程方式執行SSIS 2012包,並且需要使用PackageInfo.ExecutionValueParameterSet類來設置包和項目的值運行時的參數。有誰知道如何在PowerShell中做到這一點?我發現了下面的帖子,展示瞭如何在C#中做到這一點,但無法找到任何方式在PowerShelll中實現這一點。使用PackageInfo.ExecutionValueParameterSet類設置PowerShell中的SSIS 2012包的參數值

ssisPackage.Execute (false, null, executionParameter) times out

回答

3

下面是PowerShell代碼爲我工作:http://www.databasejournal.com/features/mssql/ssis-2012-using-powershell-to-configure-package-execution-parameters.html

$setValueParameters = New-Object 'System.Collections.ObjectModel.Collection[Microsoft.SqlServer.Management.IntegrationServices.PackageInfo+ExecutionValueParameterSet]'; 

$executionParameter = New-Object 'Microsoft.SqlServer.Management.IntegrationServices.PackageInfo+ExecutionValueParameterSet'; 
$executionParameter.ObjectType = 50; 
$executionParameter.ParameterName = "SYNCHRONIZED"; 
$executionParameter.ParameterValue = 1; 
$setValueParameters.Add($executionParameter); 

$executionIdentifier = $ssisPackage.Execute("true", $null, $setValueParameters); 

您可以通過這個鏈接下面的說明配置SSIS包的其餘部分