Reputation: 1217
I'm copying SSIS packages from one SQL server to another in a C# program via DTUTIL. The packages are in MSDB.
string dtutilCmd = "/c DTUTIL /SOURCESERVER " + sourceServer + " /SQL " + myPackage + " /DestServer " + destServer + " /COPY " + myPackage;
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = dtutilCmd;
process.StartInfo = startInfo;
process.Start();
The variables in the dtutilCmd
string are all strings. The issue is when my users input the package name they can get the case wrong. They might write MYPACKAGE
so it gets deployed as MYPACKAGE
, even if it actually exists as MyPackage
on the source server, which I want to preserve.
So I want to somehow grab the package name, and feed it into the last part of my dtutilCmd
string.
Upvotes: 1
Views: 1044
Reputation: 3591
Extract your Integration Service Catalog to ispac. Open it with SSDT, and deploy to your new server. Much easier.
Upvotes: 0
Reputation: 1429
All you need to do is make use of 'Application' class of Microsoft.Dts.Runtime namespace. You then establish a connection using that and get the packages info from the MSDB.
Here is link that gives more details on how to go about doing it programatically - Enumerating Available Packages Programmatically
Upvotes: 1