My PowershellスクリプトはSSISパッケージを実行しますが、まず環境変数をオーバーライドします。 "EnvironmentInfo [@ Name = 'MyVariable'] 'オブジェクトのOperation' Alter 'が実行中に失敗しました"という一般的なエラーメッセージで、EnvironmentInfoオブジェクトのAlterメソッドが失敗します。Powershellエラー設定SSISパッケージ実行の環境変数
また、環境変数を削除してProjectパラメータを変更しようとしましたが、ProjectオブジェクトのAlterメソッドで同じエラーが発生しました。
これは、1)SQL Server 2012の32ビット版の使用の欠点、または2)アクセス許可の問題のいずれかと思われます。
私は確信して作ったWindowsのアカウントなどSSISDBデータベースとSSISカタログプロジェクト、および子フォルダ、環境、上の完全な権限を持つ実行
エラー上の任意のアイデアや私が多くを得ることができる方法詳細は? Windowsイベントログには何も表示されません。
# Variables
$ServerInstance = "MyServer"
$32bitSQLServer = "false" #use #null for 32-bit
$SSISNamespace = "Microsoft.SqlServer.Management.IntegrationServices"
$FolderName = "MyFolder"
$ProjectName = "MyProject"
$PackageName = "MyPackage.dtsx"
$EnvironmentName = "MyEnvironment"
$VariableName = "MyVariable"
$VariableValue = Read-Host "What is the new environment variable value? "
# Create a connection to the server - Have to use Windows Authentication in order to Execute the Package
$sqlConnectionString = `
"Data Source=" + $ServerInstance + ";Initial Catalog=master;Integrated Security=SSPI;"
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection $sqlConnectionString
# Create the Integration Services object
[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.IntegrationServices")
$integrationServices = New-Object $SSISNamespace".IntegrationServices" $sqlConnection
# Get the Integration Services catalog
$catalog = $integrationServices.Catalogs["SSISDB"]
# Get the folder
$folder = $catalog.Folders[$FolderName]
# Get the project
$project = $folder.Projects[$ProjectName]
# Get the environment
$environment = $folder.Environments[$EnvironmentName]
# Get the environment reference
$environmentReference = $project.References.Item($EnvironmentName, $FolderName)
$environmentReference.Refresh()
# Get the package
$package = $project.Packages[$PackageName]
# Set the Environment Variable
$environment.Variables[$VariableName].Value = $VariableValue
$environment.Alter()
# Execute the package
Write-Host "Running Package " $PackageName "..."
$result = $package.Execute($32bitSQLServer, $environmentReference)
# Alternate approach, also not working
# $project.Parameters[$VariableName].Set([Microsoft.SqlServer.Management.IntegrationServices.ParameterInfo+ParameterValueType]::Literal,$VariableValue)
# $project.Alter()
# $result = $package.Execute($32bitSQLServer, $environmentReference)
Write-Host "Done."
ありがとう、Daveが、私はすでにそれを試しました(post&code参照)。パラメータはProject not Packageにありますので、Projectで値を設定してAlter()を呼び出しましたが、EnvironmentでAlter()を呼び出すのと同じエラーが発生しました。これは、アクセス権や32ビットSQL Serverを使用していることなど、環境に関するものと思われます。 –