Bagikan melalui


Managing Running Packages Programmatically

As you work programmatically with Integration Services packages, you may want to determine which packages are currently running. The Application class of the Microsoft.SqlServer.Dts.Runtime namespace provides methods and classes to satisfy these requirements.

For more information about monitoring packages, see Managing Packages.

All the methods discussed in this topic require a reference to the Microsoft.SqlServer.ManagedDTS assembly. After you add the reference in a new project, import the Microsoft.SqlServer.Dts.Runtime namespace with a using or Imports statement.

Important

The methods of the Application class for working with the SSIS Package Store support only ".", localhost, or the server name for the local server. You cannot use "(local)".

Determining Which Packages Are Currently Running

To determine which packages are currently running on the specified server, call the GetRunningPackages method. This method returns a RunningPackages collection of RunningPackage objects.

Note

Administrators see all packages that are currently executing on the computer; other users see only those packages that they have launched.

Working with Running Packages

After you have determined which packages are currently running, you can retrieve information about the packages and request that a package be stopped.

Getting Information about a Running Package

As you iterate through the RunningPackages collection, you can use the properties of the RunningPackage object to locate a package or to obtain additional information about the packages that are running:

Stopping a Running Package

You can call the Stop method of a RunningPackage object to request that the package be stopped. There may be a delay between the time that a stop request is issued and the time that the package actually stops.

Integration Services icon (small) Stay Up to Date with Integration Services

For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN or TechNet:

For automatic notification of these updates, subscribe to the RSS feeds available on the page.