Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Run SQL Server 2012 package with Project environment


Run SQL Server 2012 package with Project environment

Author
Message
Tifab27
Tifab27
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 26
Hi experts,

I try to launch SSIS 2012 packages stored into SSISDB with PowerShell. In my SSISDB, I have several Project environements (DEV,PROD,...); I would like to change project environnement from my PS script but I can't.

function launch_package()
{   
$instanceName = "MYSERVER"
$SSISDBFolderName = "MyFolder"
   $projectName = "MyProject"
   $packageName = "MyPackage.dtsx"
   $SSISEnvironmentName = "DEV"
   
   # import SQL Server module
   Import-Module SQLPS -DisableNameChecking

   # load the IntegrationServices assembly
Add-Type -AssemblyName "Microsoft.SqlServer.Management.IntegrationServices, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"

   $connectionString = "Data Source=$instanceName;Initial Catalog=master;Integrated Security=SSPI;"
   $conn = New-Object System.Data.SqlClient.SqlConnection $connectionString
   $SSISServer = New-Object Microsoft.SqlServer.Management.IntegrationServices.IntegrationServices $conn
   $SSISDB = $SSISServer.Catalogs["SSISDB"]
   $SSISDBFolder = $SSISDB.Folders[$SSISDBFolderName]

   $SSISDBAssoc = $SSISDBFolder.Environments[$SSISEnvironmentName]
   # Here is the issue :
   $SSISDBAssoc.References.Add($SSISEnvironmentName)
$SSISDBAssoc.Alter()
   
   
   $SSISDBAssoc.Projects[$projectName].Packages[$packageName].Execute($false, $null)
   
}



Error message is : You cannot call a method on a null-valued expression.

Any one can help ?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search