Run SSIS package from Powershell

  • I have the following powershell script:

    $html_file_dir = "C:\Scripts"

    $cvs_file = "C:\Scripts\SpaceFiles\DiskSpace_20130327060003.csv"

    $loadFile = "$cvs_file"

    $dbServer = "."

    $dbName = "ServerSpaceReports"

    #DBServer ,DBName

    $constring = "Data Source=$dbServer;Initial Catalog=$dbName;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;"

    #Data Source=.;Initial Catalog=ServerSpaceReports;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;

    #"\Package.Variables[User::PlanID].Properties[Value]";"1"

    $DTexecPath = "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DTExec"

    #cd $DTexecPath

    $setPackageVars = "/Set \Package.Variables[""CSVFile""].Value;" + """$loadFIle"""

    $command = " /F C:\scripts\Package.dtsx $setPackageVars"

    $command

    DTExec.exe $command

    When I run this I get an error:

    Option " /F C:\scripts\Package.dtsx /Set \Package.Variables[CSVFile].Value;C:\Scripts\SpaceFiles\DiskSpace_20130327060003.csv" is not valid.

    If I take the same thing and run it from a command line it runs successfully.

    I have no idea why this may be failing can any one help me out.

    Thanks

    Gary

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply