How to detect the instance that is running the package?
We have a package which is stored on serverA. The package has two variables, ServerName and InstanceName, which is supposed to be set by the server that is running the package. For example serverB, runs the package as a step in a job, and passes it's server name and instance name in via the variables. Is there anyway to detect the server name and instance name of the server that the package is being run on without having to pass them in via variables? Right now we depend on the user who creates the job on serverB to make sure to pass in the correct server and instance name when they set up the job, which could cause problems.
November 24th, 2010 10:54am

There are two ways I can think of: Get the Instance name + server name by executing a SQL Task and pass its return value to a variable in the package, or Execute a WMI task or a Script Task with some .Net code to get the above. #1 seems to me be being the easiest e.g. you can simply execute SERVERPROPERTY function to get that. Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
November 24th, 2010 11:11am

An SQL Server instance does not execute your SSIS package. That part of your question does not make sense. Asking what machine is running your package (i.e. what box launched dtexec) does make sense. To get the name of the machine executing the code you could try Environment.MachineName in the system name space.
November 24th, 2010 12:45pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics