Help calling PowerShell Function via SSIS EPT

  • Hi,

    I successfully tested this by using the following expression:

    "-ExecutionPolicy Unrestricted -File \"" + @[User::Script_Path] + "\\Exec PoSh Script.PS1\" \"" + @[User::FirstName] + "\" \"" + @[User::Surname] + "\""

    which resulted in the following Arguments:

    -ExecutionPolicy Unrestricted -File "C:\Users\XXX\Desktop\Exec PoSh Script.PS1" "FName" "LName"

    The logfile gets written to and all is fine.

    After testing, I attempted to actually accomplish what I needed done (zipping & pw protecting) by calling a PowerShell function developed here by Daniel (http://blog.danskingdom.com/powershell-function-to-create-a-password-protected-zip-file/)

    In the powershell cmd line it works perfectly when i use:

    .\c:\users\xxx\desktop\Write-ZipUsing7Zip.ps1; Write-ZipUsing7Zip -FilesToZip "C:\SomeFolder" -ZipOutputFilePath "C:\SomeFolder.zip" -Password "password123"

    When building that expression in SSIS as the Argument it does not seem to work when executing the SSIS package. Why? I think it has something to do with calling a PS Function inside the PS script.

    Thank you!

  • Is that expression exactly like you have it in SSIS?

    I wrote an article last year on how to call SSIS in the execute process task[/url] and provided an example of using expressions to pass into the arguments. You might check it out and see if it helps.

    Another thing that might make it easier is making the script file the function itself, take out trying to dot source it.

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

Viewing 2 posts - 1 through 1 (of 1 total)

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