I asked this question a couple of weeks ago:
"Pressing" the mapping tabs in the Data Flow Task without opening the solution
Now I can load the package object in PowerShell with this code:
Add-Type -Path 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.ManagedDTS\v4.0_15.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ManagedDTS.dll';
$pkg = "C:\test.dtsx";
$app = New-Object -TypeName Microsoft.SqlServer.Dts.Runtime.Application
$app | Get-Member
$Package = $app.LoadPackage($pkg, $null, $FALSE)
$Package | Get-Member
$Package.Executables
$DataFlowTask = $Package.Executables | Where-Object {$_.('Description') -eq ("Data Flow Task")};
My goal is to refresh the metadata (mappings) in the Data Flow task in both the destination and source.
I would like to call these methods on the object, which I think should do the trick (see this Link)
instance.AcquireConnections(null);
instance.ReinitializeMetaData();
instance.ReleaseConnections();
But I cannot find the Data Flow Object in the package object created above. What is the "address" on the Data Flow Task in the package object?