Execute Process Task quote encloses arguments

回答済み Execute Process Task quote encloses arguments

  • Wednesday, January 23, 2013 9:48 PM
     
     

    Is there any way to not have SSIS Exceute Process Task quote enclose the arguments?

    This is what the script task is echoing out to me via DTS.Events.FireInformation method - it is in the format I need.

    -File "C:\Development\KP Integration\KP Integration\ADExport.ps1" "C:\Test\ADUsers.csv"

    By the time the Execute Task Component consumes it, it quotes the entire expression. There is a prefix " before -File and a suffix quote at the end of the statement as shown below.

    [Execute Process Task] Error: In Executing "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-File "C:\Development\KP Integration\KP Integration\ADExport.ps1" "C:\Test\ADUsers.csv"" 

    Again, I've verified quotes are in the right places for the arguments, but the script component seems to want to qualify the entire argument string as one long string and not take the value as is, which is causing an exception

    Thanks,

    Morgan

All Replies

  • Wednesday, January 23, 2013 9:55 PM
    Moderator
     
     

    The SSIS Exceute Process Task does not quote on its own, it is just what you see in the output Window.

    Carefully revise how you placed the double quotes in the SSIS Exceute Process Task.


    Arthur My Blog

  • Wednesday, January 23, 2013 11:28 PM
     
     

    Thanks. I've read as much, but why would the DTS.Events.FireInformation echo out a non-quote enclosed value for the variable? Could it be how the variable is being processed by the expression?

    Thanks,

    Morgan

  • Thursday, January 24, 2013 12:22 AM
     
     

    This appears to be a bug with how the expression is handled in the Exec Process Task.

    Information: 0x0 at Build Path: -File "C:\Test\test.ps1" "C:\argument\path\test.csv"

    Error: 0xC0029151 at Execute Process Task, Execute Process Task: In Executing "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-File "C:\Test\test.ps1" "C:\argument\path\test.csv"" at "".

    Looks like I'll be moving the powershell integration to a step in a SQL Agent task, was trying to keep it contained to a package but it looks like the expression is converted to a literal and quote-enclosing the value rather than passing the value as-is.

  • Thursday, January 24, 2013 3:40 PM
    Moderator
     
     

    I'd say it is a subtle bug, but since this text is used to emit informational (status) messages to a console it is not critical, I do not know how this suddenly it became important, do you parse the output window a log? What does it break or stop exactly?


    Arthur My Blog

  • Thursday, January 24, 2013 3:54 PM
     
     Answered

    It's not allowing PowerShell to be invoked with arguments to a script file because the arguments are themselves quoted via the expression (I presume this is where it's happening). Thankfully I can call powershell directly via SQL Agent Job and not be in a bind. I submitted this as a bug to Microsoft on Connect with a repro project.

    Thanks for your time.

    Morgan